Radio Button Demo : RadioButton « GUI Tk « Python






Radio Button Demo

Radio Button Demo
from Tkinter import *

root = Tk()
root.title('Radiobutton')

fruit=[('Option 1', 1), ('Option 2', 2), ('Option 3', 3),
       ('Option 4', 4), ('Option 5', 5), ('Option 6', 6)]
var = IntVar()
for text, value in fruit:
    Radiobutton(root, text=text, value=value, variable=var).pack(anchor=W)
var.set(3)
root.mainloop()



           
       








Related examples in the same category

1.Toogle group Radio ButtonToogle group Radio Button
2.Radio button in a groupRadio button in a group
3.Radio Button MenuRadio Button Menu
4.Radio button bar: get selected button for a group radio buttonRadio button bar: get selected button for a group radio button
5.Get Radio button stateGet Radio button state
6.Hold on to your radio variables Hold on to your radio variables
7.Save Radio button statesSave Radio button states
8.What happens when some buttons have same valueWhat happens when some buttons have same value