[pygtk] Accessing child widgets via instance variables
Drew Vogel
dvogel at intercarve.net
Fri Aug 29 10:57:59 WST 2008
Thanks, I have this mostly working. However it looks like instead of calling
my_win.show()
I now have to call
my_win.GtkWindow.show()
Is this correct?
Drew
Pádraig Brady wrote:
> Drew Vogel wrote:
>
>> I have a glade file with a gtk.Window named my_win. It has a gtk.Button
>> on it named my_btn. When I call:
>>
>> my_win = wtree.get_widget("my_win")
>>
>> I want to be able to access my_btn as:
>>
>> my_win.my_btn
>>
>> Is there a way to make PyGTK enable this access pattern by creating
>> instance variables for child widgets automatically? I tried inspecting
>> the PyGladeXML object, but __dict__ is empty. I suspect that is because
>> it is in the C libglade.
>>
>> I found a Linux Journal article[1] that discusses a package named
>> GladeBase.UI but that is from 2001, targeted at Python 2.1b1 and Glade
>> 0.5.11. Is GladeBase still relevant?
>>
>> I'm new to PyGTK and inexperienced with Python, so please correct me if
>> I've used the wrong terminology.
>>
>> [1] http://www.linuxjournal.com/article/4702
>>
>
> Try:
> http://www.pixelbeat.org/libs/libglade.py
>
> Example usage:
> http://www.pixelbeat.org/talks/pygtk/examples/mail/
>
> Pádraig.
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20080828/be9b4e92/attachment.pgp
More information about the pygtk
mailing list