tkinter The Tkinter Radiobutton widget Create a group of radiobuttons


Such a group is made of radiobuttons that share a control variable so that no more than one can be selected.

# control variable
var = tk.IntVar(parent, 0)

# group of radiobuttons
for i in range(1,4):
    tk.Radiobutton(parent, text='Choice %i' % i, value=i, variable=var).pack()

tk.Button(parent, text='Print choice', command=lambda: print(var.get())).pack()