Tutorial by Examples

import tkinter as tk root = tk.Tk() rbvar = StringVar() rbvar.set(" ") rb1 = tk.Radiobutton(root, text="Option 1", variable=rbvar, value='a', indicatoron=0) rb1.pack() rb2 = tk.Radiobutton(root, text="Option 2", variable=rbvar, value='b', indicatoron=0) rb2...
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(p...

Page 1 of 1