[Tkinter-discuss] Radiobutton

Martin Weisel Martin.Weisel at gmx.de
Sat Feb 11 01:48:20 CET 2006


Hi everybody.

I'm currently trying to create a popup-GUI for PyMOL with Tkinter.
It's supposed to be of the form:

############################################################################
############

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()

############################################################################
############


My problem is, that I cannot read out the actual value of tmp with
tmp.get() --> it is always returning 0.
Although displaying the actual value of tmp as a dynamic label on the GUI
works very well:

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


Any help would be appreciated.
Regards,
Martin

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.6/257 - Release Date: 10.02.2006




More information about the Tkinter-discuss mailing list