[Tkinter-discuss] Radiobutton

Martin Weisel Martin.Weisel at gmx.de
Mon Feb 13 10:43:43 CET 2006


Hi Doug,

>Your example works for me. I'm on Linux, Python 2.4.1, FC4
This example works fine for python, but unfortunately it's not working in
PyMOL. 

>I don't usually use globals; maybe you have another global somewhere
>colliding with the one that you are using?
There is definitely no colliding of variables - this prog does not work when
used as the only code.

>from Tkinter import *
>root = Tk()
>
>def radio1():
>	global tmp
>	tmp = IntVar()
>	Yes = Radiobutton(root, text = 'yes', value = 1 , variable = tmp)
>	Yes.pack(side = LEFT)
>	Yes.select()	#set Yes initially
>	No = Radiobutton(root, text = 'no', value = 2 , variable = >tmp).pack(side
=
>LEFT)

>radio1()
>root.mainloop() 

I think it must be a PyMOL specific problem. For some reason the .get()
method is unable to get the actual value of the Radiobutton. The strange
thing is that the Label has no problems in displaying the actual value of
tmp. I'm wondering if there's a way to read out 'textvariable' of the
Label!?

>Label(root, textvariable = tmp).pack(side = LEFT)

Regards,
Martin


-- 
Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner


More information about the Tkinter-discuss mailing list