problem with GKT module?

alister ware alister.ware at ntlworld.com
Mon May 16 08:29:43 EDT 2011


On Sun, 15 May 2011 20:42:46 -0500, harrismh777 wrote:

> Alister Ware wrote:
>> I have a simple call back defined for a radio button widget when I use
>>>  widget.name in linux I get a value of None, windows returns the
>>>  widget name as I would expect.
>>>
>>>
> First, not familiar with your issue...
> 
> ... but might be able to help you think through it...
> 
> I am assuming that you are building a Python script using a glade
> interface that provides the widgets drag-an-drop style and then allowing
> you to take the default code, add to it, or otherwise modify it.
> 
> I am also assuming that the /call back/ is returning a Python None, on
> the linux platform... otherwise you're getting the widget name from the
> same script on the windows platform??  right?
> 
> It might be helpful to examine both scripts to see where (if any) they
> differ. More likely than not, this little snag is a difference in the
> way that the windows version of gtk+ libraries are working, than the
> original ones on the linux platform.
> 
> On the other hand, the Python wrappers for the gtk+ library on the linux
> platform may be hiding the return values. Python functions return 'None'
> if the 'return' is not explicitly coded. The gtk+ libraries may be
> returning a value but the 'builder' is not generating the right Python
> wrapper. I'm making this up, but you get the idea, and you can probably
> check from here.
> 
> On the other hand, folks here can enter into a discussion with you
> regarding the generated Python code (output from the builder) if you
> provide relevant code snippets.
> 
> 
> Kind regards,
> m harris

glade generates an xml file that is processed by the python script

it is the same ml file & the same python script running on both platforms

the basic structure of my call back for testing is:-

import gtk
class GUI:
	def __init__(self):
		builder=gtk.Builder()
		builder.add_from_file('glade.test') # xml file from glade
		builder.get_object('window1').show()
		builder.connect_signals(self)


	def callback(self,widget,data=None):
		print widget	#gives reference to radio button ok
		print widget.name #widget name on windoze, None on linux
	def main (self):
		gtk.main()

def main():
	gui=GUI()
	gui.main()

if __name__ =='__main__':main()

I can provide more detailed sample code if required (including the xml 
from glade)


-- 
Has everyone noticed that all the letters of the word "database" are
typed with the left hand?  Now the layout of the QWERTYUIOP typewriter
keyboard was designed, among other things, to facilitate the even use
of both hands.  It follows, therefore, that writing about databases is
not only unnatural, but a lot harder than it appears.



More information about the Python-list mailing list