When you modified the code, you added the three radio buttons like this:
Radiobutton(app, text Radiobutton(app, text Radiobutton(app, text
'Cambridge, MA").pack() 'Cambridge, UK").pack() '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.
Cambridge, MA Cambridge, UK ^J Seattle, WA
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 buttons to be deselected, just like the buttons on the radio.
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?
When the AM button is selected, the FM button should be deselected.
Think about the way you want radio buttons to work. Is there something that they all need to share? What is it?
Was this article helpful?