Sex, 2005-11-25 às 15:19 -0200, Christian Robottom Reis escreveu:
> On Fri, Nov 25, 2005 at 03:39:55AM -0300, João Paulo Silva wrote:
> > I've seen the PyGTK FAQ 22.7 [1] about Custom widgets in Glade files
> > and I found an error at the lines:
> >
> > class MyGladeApp:
> >
> > def __init__ (self):
> > self.glade = gtk.glade.XML('/path/to/gladefile.glade')
> > self.glade.set_custom_handler(self.get_custom_handler)
> >
> > When I made some tests, I received:
> >
> > libglade-WARNING **: could not find widget creation function
> >
> > This doesn't worked for me. It just worked when I made something like:
> >
> > class MyGladeApp:
> >
> > def __init__ (self):
> > gtk.glade.set_custom_handler(self.get_custom_handler)
> > self.glade = gtk.glade.XML('/path/to/gladefile.glade')
> >
> > First, it's not a self.glade method, but gtk.glade function.
> > Second: It just worked when "set_custom_handler" comes before the XML
> > loading (why this?).
>
> Because you need to set up custom handlers before processing the glade
> XML (they are used to construct widgets, which happens at
> construction-time). Please update the FAQ -- and good catch.
>
> This made me think that we might want to separate the parsing of the
> tree into a separate method; something like:
>
> self.tree = gtk.glade.XML("foo.glade")
or maybe:
self.tree = gtk.glade.XML("foo.glade",
custom_handler=self.custom_widget_handler)
Cheers,
--
Gustavo J. A. M. Carneiro
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
The universe is always one step beyond logic.
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/