[pygtk] automagical glade
Chris Camacho
chris_camacho at yahoo.com
Wed Apr 15 03:02:06 WST 2009
I've seen a lot of code with reams of variable=xml.get_widget statements
and manually updated dictionaries of handler functions all of which is
deeply unsatisfying, inelegant and prone to error
Taking inspiration from a number of sources I have pieced together a very
simple and short framework which integrates tightly with a .glade file
It has the following features:-
glade handlers are automatically mapped to functions within the handlers class
All most all of your code will end up in handler class functions with very little setup code
All widgets are mapped to a user interface object via their glade id and so they can be accessed like this...
ui.entry1.set_text("hello world")
The code is commented, it
should be simple
to follow and in addition
techniques like __getattr__ should be useful for novice pythonites
I'd appreciate any improvements providing they don't add extra complexity
Hope this helps
Chris_C
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20090414/981fe926/attachment-0001.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: autoconnect.py
Type: text/x-python
Size: 2205 bytes
Desc: not available
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20090414/981fe926/attachment-0001.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.glade
Type: application/x-glade
Size: 3619 bytes
Desc: not available
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20090414/981fe926/attachment-0001.bin
More information about the pygtk
mailing list