[pygtk] setting state of lots unknown widgets in class

spooky.ln at tbs-software.com spooky.ln at tbs-software.com
Tue Dec 28 23:41:09 WST 2010


Hi all,
I’m write some app where is N-th widgets.
Widgets are CheckButtons, Entrys and HScales.
Becouse i rewriting this app a lot i never know how much widgets i have .
But i have ‘Clear’ button. This button sets all widgets into ‘clear’ state. but how on N-th widgets ?

with self.__dict__ i have all values from class what i need, but its string type.
i mean this:

for widget in self.__dict__:
    # i know ‘widget’ is now ‘str’ type but forgot about it for now.
    try:
          if type(widget) == gtk.CheckButton:
                 widget.set_active(False)
...
...
...

Do you know what i mean ?   sry for my english.
any idea without using evil ‘eval’. any clear way ?
thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.daa.com.au/pipermail/pygtk/attachments/20101228/01612c9d/attachment.html>


More information about the pygtk mailing list