Show More
@@ -1,37 +1,37 | |||
|
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 [1]: %gui gtk3 |
|
7 | 7 | |
|
8 | 8 | In [2]: %run gui-gtk3.py |
|
9 | 9 | """ |
|
10 | 10 | |
|
11 | 11 | from gi.repository import Gtk |
|
12 | 12 | |
|
13 | 13 | |
|
14 | 14 | def hello_world(wigdet, data=None): |
|
15 |
print |
|
|
15 | print("Hello World") | |
|
16 | 16 | |
|
17 | 17 | def delete_event(widget, event, data=None): |
|
18 | 18 | return False |
|
19 | 19 | |
|
20 | 20 | def destroy(widget, data=None): |
|
21 | 21 | Gtk.main_quit() |
|
22 | 22 | |
|
23 | 23 | window = Gtk.Window(Gtk.WindowType.TOPLEVEL) |
|
24 | 24 | window.connect("delete_event", delete_event) |
|
25 | 25 | window.connect("destroy", destroy) |
|
26 | 26 | button = Gtk.Button("Hello World") |
|
27 | 27 | button.connect("clicked", hello_world, None) |
|
28 | 28 | |
|
29 | 29 | window.add(button) |
|
30 | 30 | button.show() |
|
31 | 31 | window.show() |
|
32 | 32 | |
|
33 | 33 | try: |
|
34 | 34 | from IPython.lib.inputhook import enable_gtk3 |
|
35 | 35 | enable_gtk3() |
|
36 | 36 | except ImportError: |
|
37 | 37 | Gtk.main() |
General Comments 0
You need to be logged in to leave comments.
Login now