Bizarre Tkinter radio button behaviour

Greg Ewing greg.ewing at compaq.com
Wed Jul 7 23:07:24 EDT 1999


I have some sets of radio buttons linked to
Tkinter variables. I set the initial values of
the variables, expecting the corresponding 
buttons to come up selected when the window
first appears.

But it doesn't happen.

I mess around trying different things. I
add a command to one of the radio buttons to
print out the values of the variables when
they change. All of a sudden the buttons
start appearing with default selections.

Great, I think, and take out my debugging code...
and they stop working again!

After some more trial and error I find that
if *one* of the radio buttons has a command
attached -- even just an empty procedure --
then *all* of the default buttons come up
properly selected. Otherwise, none of them
do.

Has anyone else noticed this behaviour?
Is it a bug in Tk or Tkinter? Or have I done
something silly somewhere?

Python 1.5.2 and Tk 8.0, btw.

Shaking his head in bewilderment,
Greg




More information about the Python-list mailing list