Tkinter入门
前页 |  | 后页

# Chapter 23. The Checkbutton Widget

The `Checkbutton` widget is a standard Tkinter widgets used to implement on-off selections. Checkbuttons can contain text or images, and you can associate a Python function or method with each button. When the button is pressed, Tkinter automatically calls that function or method.

The button can only display text in a single font, but the text may span more than one line. In addition, one of the characters can be underlined, for example to mark a keyboard shortcut. By default, the Tab key can be used to move to a button widget.

Each Checkbutton widget should be associated with a variable.

# When to use the Checkbutton Widget

The checkbutton widget is choose between two distinct values (usually switching something on or off). Groups of checkbuttons can be used to implement "many-of-many" selections.

To handle "one-of-many" choices, use `Radiobutton` and `Listbox` widgets.

前页 | Home | 后页
Options | Up | Patterns