File: hello1.py

package info (click to toggle)
python-gtk 0.5.3-2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 1,604 kB
  • ctags: 4,295
  • sloc: ansic: 19,390; python: 8,220; makefile: 91; sh: 26
file content (34 lines) | stat: -rwxr-xr-x 657 bytes parent folder | download
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
33
34
#!/usr/bin/env python

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

from _gtk import *
from _gtkbase 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()
pygtk_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()