On Wed, 9 May 2001, Juergen Daubert wrote:
>
> Hi all,
>
> I try to build some new classes based on standard gtk classes. To show
> my problems
> some code follows:
>
> ---
> class myEntry(gtk.GtkEntry):
> def __init__(self, new_attr):
> gtk.GtkEntry.__init__(self)
> self.new_attr = new_attr
>
> def myFunc(widget):
> print widget.new_attr
>
> new_entry = myEntry("something")
> new_entry.connect("changed", myFunc)
> ---
>
> The print statement in myFunc raises an attribute error, because the
> parameter
> widget points to the GtkEntry base class and not to myEntry.
>
> How can i solve this ?
There isn't any good answer to this problem for the stable branch of
pygtk. You could try connecting bound methods of myEntry() to the signal,
so they can access the original instance via self.
The problem is fixed in devel pygtk, however.
James.
--
Email: [EMAIL PROTECTED]
WWW: http://www.daa.com.au/~james/
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk