[pygtk] Pygtk + Glade + OO
Guillaume Proux
guillaume.proux at scala.com
Tue Oct 11 10:18:23 WST 2005
Hi Phil,
Maybe you can do something I do a lot. I create a wrapper for the object
I inserted in my gladefile (like a treeview) for example. And I use the
__getattr__ to call into the wrapped object.
For example
class TreeViewWrapper:
def __init__(self,wrappedobj):
self._obj = wrappedobj
def __getattr__(self,attr):
return getattr(wrappedobj,attr)
def a_new_method(self,a):
pass
treeview = TreeViewWrapper(mygladetree.get_widget("tv"))
treeview.a_new_method()
Regards,
Guillaume
philopensource at hotmail.com wrote:
> Hi list,
>
> I want to design my gui using glade and then inherit some classes from
> widget of the gui.
> As i can only get the instance of widgets using
> gtk.glade.XML.get_widget(name), how can i inherit some classes from the
> instance?
>
> Thanks a lot for your answer.
> Philippe Collet
>
More information about the pygtk
mailing list