#!/usr/bin/env python # example helloworld2.py import gtk class
HelloWorld2: # Our new improved callback. The data passed to
this method # is printed to stdout. def callback(self, widget,
data): print "Hello again - %s was pressed" % data # another
callback def delete_event(self, widget, event, data=None):
gtk.mainquit() return gtk.FALSE def __init__(self): # Create a
new window self.window = gtk.GtkWindow(gtk.WINDOW_TOPLEVEL) #
This is a new call, which just sets the title of our # new
window to "Hello Buttons!" self.window.set_title("Hello
Buttons!") # Here we just set a handler for delete_event that
immediately # exits GTK. self.window.connect("delete_event",
self.delete_event) # Sets the border width of the window.
self.window.set_border_width(10) # We create a box to pack
widgets into. This is described in detail # in the "packing"
section. The box is not really visible, it # is just used as a
tool to arrange widgets. self.box1 = gtk.GtkHBox(gtk.FALSE, 0) #
Put the box into the main window. self.window.a