slotUI/SlotUi.py

changeset 23
6edcf4666e3b
child 24
84f6f0592555
equal deleted inserted replaced
22:9af54a45ae42 23:6edcf4666e3b
1 #!/usr/bin/env python
2
3 import pygtk
4 pygtk.require('2.0')
5 import gtk
6
7 class SlotUi:
8 """
9 Graphical User Interface
10 using GTK
11 """
12 def delete_event(self, widget, event, data=None):
13 if widget == self.window:
14 self.destroy(widget, data)
15 #return true to stop window destruction
16 return False
17
18 def destroy(self, widget, data=None):
19 gtk.main_quit()
20
21 def __init__(self):
22 # create main window
23 self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
24 self.window.connect("delete_event", self.delete_event)
25 self.button = gtk.Button("Hello World")
26 self.button.connect("clicked", self.hello, None)
27
28 self.window.add(self.button)
29 self.button.show()
30 self.window.show()
31
32 def hello(self, widget, param1):
33 print widget
34 print "hello"
35
36 def main(self):
37 gtk.main()
38
39 if __name__ == "__main__":
40 app = SlotUi()
41 app.main()

mercurial