summaryrefslogtreecommitdiff
path: root/examples/simple/hello1.py
blob: 60b9ab1815b4805a53500d4522325c67e930da90 (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
30
31
32
#!/usr/bin/env python

# this is a translation of "Hello World III" from the GTK manual,
# using gtkmodule

from _gtk import *
from GTK import *

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

def destroy(*args):
    gtk_widget_hide(window)
    gtk_main_quit()

gtk_init()

window = gtk_window_new(WINDOW_TOPLEVEL)
gtk_signal_connect(window, "destroy", destroy)
gtk_container_border_width(window, 10)

button = gtk_button_new_with_label("Hello World")
gtk_signal_connect(button, "clicked", hello)
gtk_container_add(window, button)
gtk_widget_show(button)

gtk_widget_show(window)

gtk_main()