ttk::checkbutton(n)
π ttk::checkbutton(n) β the Tk Themed Widget π
β¨ NAME β¨
ttk::checkbutton β the iconic on/off widget, no cap β¨
π SYNOPSIS π
ttk::checkbutton pathName ?options?
π¦ DESCRIPTION π¦
Okay so bestie, a ttk::checkbutton widget is literally what you use to show or change a setting. It's got two states: selected and deselected. And the state of the checkbutton may be linked to a Tcl variable. It's giving "toggle queen" energy. π
π STANDARD OPTIONS π
The standard options are -class, -compound, -cursor, -image, -state, -style, -takefocus, -text, -textvariable, -underline, and -width. See the ttk_widget manual entry for details on the standard options. β¨
π WIDGET-SPECIFIC OPTIONS π
-commandβ A Tcl script to execute whenever the widget is invoked. (Database name:command, database class:Command) π₯-offvalueβ The value to store in the associated-variablewhen the widget is deselected. Defaults to0. (Database name:offValue, database class:OffValue) π-onvalueβ The value to store in the associated-variablewhen the widget is selected. Defaults to1. (Database name:onValue, database class:OnValue) π₯-variableβ The name of a global variable whose value is linked to the widget. Defaults to the widget pathname if not specified. (Database name:variable, database class:Variable) π«Ά
π WIDGET COMMAND π
In addition to the standard cget, configure, identify element, instate, state and style commands (see ttk::widget), checkbutton widgets support the following additional commands:
pathname invokeβ Toggles between the selected and deselected states and evaluates the associated-command. If the widget is currently selected, sets the-variableto the-offvalueand deselects the widget; otherwise, sets the-variableto the-onvalue. Returns the result of the-command. π«
π§ WIDGET STATES π§
- The widget does not respond to user input if the disabled state is set. π«
- The widget sets the selected state whenever the linked
-variableis set to the widget's-onvalue, and clears it otherwise. β - The widget sets the alternate state whenever the linked
-variableis unset. π
The alternate state may be used to indicate a "tri-state" or "indeterminate" selection. π
πΈ STANDARD STYLES πΈ
Ttk::checkbutton widgets support the Toolbutton style in all standard themes, which is useful for creating widgets for toolbars. π οΈ
π STYLING OPTIONS π
The class name for a ttk::checkbutton is TCheckbutton. π·οΈ
Dynamic states: active, alternate, disabled, pressed, selected, readonly. β¨
TCheckbutton styling options configurable with ttk::style are:
-backgroundcolor-compoundcompound-foregroundcolor-indicatorbackgroundcolor-indicatorcolorcolor-indicatormarginpadding-indicatorreliefrelief-paddingpadding
Some options are only available for specific themes. π
See the ttk::style manual page for information on how to configure ttk styles. π
π SEE ALSO π
ttk::widget(n), ttk::radiobutton(n), checkbutton(n) π
β KEYWORDS β
widget, button, toggle, check, option π
This page is from Tk 8.5, bestie! Stay toggling! πβ¨π«Ά
π¦ where this page comes from
- alpine 3.23: tk9-doc 9.0.3-r0 Β· TCL
- alpine 3.24: tk9-doc 9.0.3-r2 Β· TCL
- fedora 43: tk 1:9.0.2-1.fc43 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 43: tk 1:9.0.2-1.fc43 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 44: tk 1:9.0.2-1.fc44 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 44: tk 1:9.0.2-1.fc44 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- nixos 26.05: tk 9.0.3
- nixpkgs unstable: tk 9.1.0
- Copyright (c) 2004 Joe English
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms