problem with GKT module?

Alister Ware alister.ware at ntlworld.com
Tue May 17 15:26:58 EDT 2011


On Mon, 16 May 2011 14:56:38 -0500, harrismh777 wrote:

> alister ware wrote:
>> 	def callback(self,widget,data=None):
>> 		print widget	              #gives reference to radio 
button ok print
>> 		widget.name             #widget name on windoze, None on 
linux
> 
> Well, you're obviously using Python 2.x ...
> 
>     ... have you tried this in Python 3.x ?
> 
> 
> Neither here nor there...  you need to know who/what is generating
> 'widget'.  Is widget buried in gtk where you can't see how it works, or
> is widget a Python class (or wrapper) where you can see what its doing?
> 
> The fact that widget.name returns None on the linux platform tells me
> that widget is a Python class (or wrapper) ... so you probably have a
> widget.py file somewhere... or some other module that widget is a class
> definition in... who knows... (at this point).
> 
> It seems to me that the 'builder' is behaving differently on the two
> platforms (rather than Python is behaving differently on the two
> platforms).
> 
> What happens if you change the data=None pair?
> 
> What happens if you omit data=None pair?
> 
> Do you see this difference with *all* widgets, or just radio buttons?
> 
> 
> 
> kind regards,
> m harris

It seems it was introduced in pygtk 2.1.7 as a side effect of correcting 
something to do with widget id's and the fact that widget names do not 
have to be unique (although glade insists that they are).

looks like i have to modify my code & use gtk.buildable.get_name(widget) 
instead, not really a big change but may break someone else's code 



-- 
If you're not careful, you're going to catch something.



More information about the Python-list mailing list