Page 310 -
P. 310
guis and data
The radio buttons should work together
When you modified the code, you added the three radio buttons like this:
Radiobutton(app, text = "Cambridge, MA").pack()
Radiobutton(app, text = "Cambridge, UK").pack()
Radiobutton(app, text = "Seattle, WA").pack()
That code added three new radio buttons to the interface, but it created
them as three independent widgets. This means that each of the radio buttons is
working separately, with no knowledge of the other two.
Look, I don‛t care
what you guys do, I‛m
gonna stay selected.
Yeah,
me too.
Huh, and me.
When the AM button is
But the whole point of radio buttons is that they work together.
When you select one radio button, you expect all of the other radio selected, the FM button
buttons to be deselected, just like the buttons on the radio. should be deselected.
GUI programs often need to synchronize different widgets
together. You do something to one widget, which results in
something else happening to another widget.
So how might you get your radio buttons to
cooperate?
Think about the way you want radio buttons to work. Is there something
that they all need to share? What is it?
you are here 4 275