old blog,

Using Glade to write GUI applications

Izhar Firdaus Izhar Firdaus Follow Support Jun 22, 2007 · 1 min read
Using Glade to write GUI applications
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.
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 gtk.glade
#!/usr/bin/python
import gtk
import gtk.glade


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


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


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

xml.signal_autoconnect(dict)


6. run gtk instance
gtk.main()


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 )

pyglade-gentemplate.py
Written by Izhar Firdaus Follow Support
I'm a system architect, data engineer and developer advocate with passion in Free / Open Source software, entrepreneurship, community building, education and martial art. I take enjoyment in bridging and bringing together different FOSS technologies to help businesses and organizations utilize IT infrastructure to aid and optimize their business and organizational process.

VMXGenerator.py : Python program to generate VMware configuration

Ok, I'm bored during this holidays .. While surfing around and playing with Xen and VMWare, I stumbled upon this http://sanbarrow.com...

In old blog, Jun 21, 2007

« Previous Post

Compiz Fusion is here

The merge of compiz and beryl have already created an offspringIntroducing Compiz Fusionhttp://youtube.com/watch?v=E4Fbk52Mk1wIf you ...

In old blog, Jun 24, 2007

Next Post »