If you want a wysiwyg GUI designer, Glade is your best bet:
glade from the software centre
create your GUI, save it as, say,
Go to the signals tab and set up your callback, such as
In your python program, tell GTK to load the UI definitions
class MyApp (object):
self.builder = gtk.Builder()
def on_window1_destroy(self, *args):
After getting everything set up, you can dive straight into the Glade tutorial (as Jeremy Kerr mentioned in his answer). Start by learning about the different lay–out options and signals.
When you feel comfortable with glade, you can start using it via Quickly, which is a set of programs to make the common tasks in developing software very easy. It takes care of translations, storing configuration, packaging, launchpad integration including PPAs, and lots more:
sudo apt-get install quickly
quickly create ubuntu-application hello-world
Quickly now creates a huge project with everything you need already set up. A gui, the translation files, configuration via desktopcouch, and so on.
You'll see quickly sets up a few windows (the main App, configuration, and an about dialogue) for you. To start editing your GUI:
To get to the app's code, run
Go to the
Now start adding signal handlers and logic.
Finally, to run your application, type
At this point, you can get into the PyGTK documentation in order to learn about the signals, their handlers' signatures, the different widgets' methods and so on.
See also, some related questions: