File: simple2.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 (26 lines) | stat: -rwxr-xr-x 558 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
#!/usr/bin/env python

# translation of "Hello World III" from gtk manual, using the new() function
# from Gtkinter

from Gtkinter import *

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

def destroy(*args):
	window.hide()
	mainquit()

window = new(GtkWindow, type=WINDOW_TOPLEVEL, title='Hello World',
	     allow_grow=FALSE, allow_shrink=FALSE, border_width=10)
window.connect("destroy", destroy)

print ""
button = new(GtkButton, label="Hello World", parent=window, visible=TRUE)
button.connect("clicked", hello)

window.show_all()
mainloop()