Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > by-pkgid > 588c71952052d435fa8f58dfc1226168 > files > 89

pygtk-0.6.9-1mdk.i586.rpm

#!/usr/bin/env python

# translation of "Hello World III" from GTK manual, using new() function
# from gtk.py.  Also implements a tooltip for the button.

from gtk import *

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

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

tt = GtkTooltips()
tt.set_delay(500)

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

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

tt.set_tip(button, 'Prints "Hello World"', '')
tt.enable()

window.show()
mainloop()