This repository was archived by the owner on Jul 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisualFunctionMapping.py
More file actions
89 lines (57 loc) · 2.34 KB
/
Copy pathvisualFunctionMapping.py
File metadata and controls
89 lines (57 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# cells = sheet['A1': 'B6']
# for c1, c2 in cells:
# print("{0:8} {1:8}".format(c1.value, c2.value))
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
# import openpyxl
# book = openpyxl.load_workbook('./new/ia.xlsx')
# sheet = book.active
# cells = sheet['A1': 'B6']
# for c1, c2 in cells:
# print("{0:8} {1:8}".format(c1.value, c2.value))
class ComboBoxWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="IA")
self.set_border_width(10)
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
hbox = Gtk.Box(spacing=6)
self.add(vbox)
label = Gtk.Label("Entrada do caso problema:")
vbox.pack_start(label, True, True, 0)
label = Gtk.Label("Atributos:")
vbox.pack_start(label, True, True, 0)
country_store = Gtk.ListStore(str)
countries = ["Austria", "Brazil", "Belgium", "France", "Germany",
"Switzerland", "United Kingdom", "United States of America",
"Uruguay"]
for country in countries:
country_store.append([country])
country_combo = Gtk.ComboBox.new_with_model(country_store)
country_combo.connect("changed", self.on_country_combo_changed)
renderer_text = Gtk.CellRendererText()
country_combo.pack_start(renderer_text, True)
country_combo.add_attribute(renderer_text, "text", 0)
vbox.pack_start(country_combo, False, False, True)
vbox.add(hbox)
button = Gtk.Button.new_with_mnemonic("_Fechar")
button.connect("clicked", self.on_close_clicked)
hbox.pack_start(button, True, True, 0)
button = Gtk.Button.new_with_label("Continuar")
button.connect("clicked", self.on_click_me_clicked)
hbox.pack_start(button, True, True, 0)
def on_click_me_clicked(self, button):
print("\"Click me\" button was clicked")
def on_close_clicked(self, button):
print("Closing application")
Gtk.main_quit()
def on_country_combo_changed(self, combo):
tree_iter = combo.get_active_iter()
if tree_iter is not None:
model = combo.get_model()
country = model[tree_iter][0]
print("Selected: country=%s" % country)
win = ComboBoxWindow()
win.connect("destroy", Gtk.main_quit)
win.show_all()
Gtk.main()