Friday, June 22, 2007

Using Glade to write GUI applications

A few useful links for people who want to learn on how to write GTK applications using Glade

The video for using Glade with Python is not very clear, so I'll explain a little bit the process below.

1. Build your GUI

2. Open a .py file, and import gtk and
import gtk

3. define your handlers method
def hander_method(widget):

4. load the glade XML
xml ="/path/to/glade/file")

5. connect handlers to its methods/functions
dict = { 'handler_name' : handler_method,
'handler_name2' : handler_method2


6. run gtk instance

I also have written a similar script to the ruby glade template generator in Video 3. It'll generate a very basic Python template for use. ( I couldn't find where to download GladeGen )
Post a Comment
Locations of visitors to this page