Hi folks,

I figured out how to preselect a Radiobutton in a Tkinter-GUI. One ought to
use .select() instead of .set().
But now I've come up with another problem: How do I get the actual value of
that Radiobutton? For some reason .get() is returning 0 all the times. 

from Tkinter import *
radio = Tk()

radiovar = IntVar()
Yes = Radiobutton(radio, text='Yes', value =1, variable = radiovar)
Yes.pack(side = LEFT)
Yes.select()
No = Radiobutton(radio, text='No', value =2, variable = radiovar)
No.pack(side=LEFT)

Although .get() does not work, displaying the actual value of radiovar as a
dynamic label on the GUI works very well:

Label(radio, textvariable=radiovar).pack(side = RIGHT)

How do I get the actual value of that Radiobutton? In case .get() doesn't
work at all, is there a way of reading out the textvariable of the Label?

I would appreciate any help.
Regards,
Martin


-- 
DSL-Aktion wegen großer Nachfrage bis 28.2.2006 verlängert:
GMX DSL-Flatrate 1 Jahr kostenlos* http://www.gmx.net/de/go/dsl

Reply via email to