[Tkinter-discuss] initial state of radiobutton

Iain Day iain at day-online.org.uk.invalid
Thu Aug 14 22:19:10 CEST 2008


I'm trying to create a preferences dialog. At the moment, I'm just 
reading a config file using ConfigParser and displaying this in a 

I've got some Entry widgets working okay, but I can't get the 
radiobuttons to work. The code is:

import Tkinter as tk

settings = tk.LabelFrame(master, text="Settings")
settings.grid(row=0, column=0)

tk.Label(settings, text="Angular Units: ").grid(row=0, column=0, 

angles = tk.StringVar(value=__main__.angles)

tk.Radiobutton(settings, text="Degrees", variable=angles, 
value='degrees').grid(row=0, column=1)

tk.Radiobutton(settings, text="Radians", variable=angles, 
value='radians').grid(row=0, column=2)

When I run this, angles is set to degrees but I don't get the 
radiobutton active (either of them).

What am I doing wrong?



More information about the Tkinter-discuss mailing list