summaryrefslogtreecommitdiff
path: root/examples/simple/simple.py
blob: 9785830129e04a3bde22dfbbe765b56bdb617b68 (plain)
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
#!/usr/bin/env python

# translation of the simple.c test in the gtk+ distribution, using the
# new() function from gobject (this is an example of creating objects
# with the properties interface).

import gobject, gtk

def hello(*args):
    print "Hello World"
    window.destroy()

def destroy(*args):
    window.hide()
    gtk.main_quit()

window = gobject.new(gtk.Window,
                     type=gtk.WINDOW_TOPLEVEL,
                     title='Hello World',
                     allow_grow=False,
                     allow_shrink=False,
                     border_width=10)
window.connect("destroy", destroy)

button = gobject.new(gtk.Button, label="Hello World", parent=window)
button.connect("clicked", hello)

window.show_all()
gtk.main()