##// END OF EJS Templates
Minor work on the gtk example.
Brian Granger -
Show More
@@ -1,35 +1,43 b''
1 1 #!/usr/bin/env python
2 2 """Simple GTK example to manually test event loop integration.
3 3
4 4 This is meant to run tests manually in ipython as:
5 5
6 6 In [5]: %gui gtk
7 7
8 8 In [6]: %run gui-gtk.py
9 9 """
10 10
11 11
12 12 import pygtk
13 13 pygtk.require('2.0')
14 14 import gtk
15 15
16 16
17 17 def hello_world(wigdet, data=None):
18 18 print "Hello World"
19 19
20 def delete_event(widget, event, data=None):
21 return False
22
23 def destroy(widget, data=None):
24 gtk.main_quit()
25
20 26 window = gtk.Window(gtk.WINDOW_TOPLEVEL)
27 self.window.connect("delete_event", delete_event)
28 self.window.connect("destroy", destroy)
21 29 button = gtk.Button("Hello World")
22 30 button.connect("clicked", hello_world, None)
23 31
24 window.add(self.button)
32 window.add(button)
25 33 button.show()
26 34 window.show()
27 35
28 36 try:
29 37 from IPython.lib.inputhook import appstart_gtk
30 38 appstart_gtk()
31 39 except ImportError:
32 40 gtk.main()
33 41
34 42
35 43
General Comments 0
You need to be logged in to leave comments. Login now