On Thu, 26 Oct 2000, Alexandre Fayolle wrote:

> Hi,
> 
> I have a class derived from GtkDialog, and set up a callback on a button
> using connect_object and passing the derived dialog as an argument.
> The problem is that when the dialog is passed to to callback function, it
> has been cast into a GtkWindow object and I cannot access the controld I
> defined as member variables in my class:
> 
> Traceback (innermost last):
>   File "/usr/lib/python1.5/site-packages/gtk.py", line 125, in __call__
>     ret = apply(self.func, a)
>   File "Narval/narval/Horn.py", line 358, in narval_home_changed
>     path = selector.selectionEntry.get_text()
>   File "/usr/lib/python1.5/site-packages/gtk.py", line 908, in __getattr__
>     return GtkWindow.__getattr__(self, attr)
>   File "/usr/lib/python1.5/site-packages/gtk.py", line 75, in __getattr__
>     raise AttributeError, attr
> AttributeError: selectionEntry
> 
> I suppose I'm not the first one to encounter the problem. Are there any
> workarounds ?  

You get a different GtkObject wrapper passed in the signal handler, so
you don't see the attributes.  Instead, try using the get_data() and
set_data() methods to associate data with a particular GtkObject.  This
will be available in the signal handler.

This problem wil go away in the pygtk release for gtk 2.0.  I will
probably put up a snapshot tarball of this in a little while (it doesn't
do signals at the moment).

James.


_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to