Creating radio buttons in tkinter

You need to create three radio buttons in the interface, one for each of the depots. This is how you might do that in tkinter:

You don't need -the f ield anymore-

You don't need -the f ield anymore-

Label(app, text = "Depot:").pack()

Radiobutton(app, text = "Cambridge, MA").pack() â– Radiobutton(app, text = "Cambridge, UK").pack() â– Radiobutton(app, text = "Seattle, WA").pack()

Label(app, text = "Description:").pack()

" the text ' that wiII

"e*f the radio button.

You need to remove the depot Entry widget and replace it with three Radiobutton widgets, one for each of the valid depots. The text given to each widget will be the text that appears alongside the radio button in the interface.

What about reading which radio button has been selected? For now, you just need to create a prototype of the interface, so there's no need to change any of the code that saves records. That's something we can deal with later.

Let's demo the new interface to the guys at Head-Ex.

Was this article helpful?

0 0

Post a comment