ttk::radiobutton(3tk)
π ttk::radiobutton β the Tk Themed Widget era π
okay bestie, welcome to ttk::radiobutton(3tk), one of the Tk themed widgets. yes we're in the manual pages, no it's not boring, stay with me π«Ά
β¨ NAME β¨
ttk::radiobutton β mutually exclusive option widget
like, the whole point is that only ONE of them can be picked at a time. iconic behavior honestly π
πΈ SYNOPSIS πΈ
ttk::radiobutton pathName ?options?
π DESCRIPTION π
so ttk::radiobutton widgets roll in groups, and the group is there to show or change a set of mutually-exclusive options β meaning picking one un-picks the others, no drama, no overlap, we love a clean system π
Each radiobutton is linked to a Tcl variable, and it has an associated value. When you click a radiobutton, it sets that variable to its associated value. that's the whole move. that's the vibe. β¨
π STANDARD OPTIONS π
-class-compound-cursor-image-state-style-takefocus-text-textvariable-underline-width
head over to the ttk_widget manual entry if you want the deets on all the standard options, bestie. i'm not gonna re-explain the classics π
π¦ WIDGET-SPECIFIC OPTIONS π¦
okay these are the ones that make radiobuttons radiobuttons, pay attention π
-command(Command-Line Name:-command; Database Name:command; Database Class:Command) β a Tcl script to evaluate whenever the widget is invoked. like, every single time. it's giving "reactive" π₯-value(Command-Line Name:-value; Database Name:Value; Database Class:Value) β the value that gets stored in the associated-variablewhen the widget is selected. this is literally the thing that makes it this option and not the other ones π-variable(Command-Line Name:-variable; Database Name:variable; Database Class:Variable) β the name of a global variable whose value is linked to the widget. default value is::selectedButton. yes, that's the default, no cap π
π WIDGET COMMAND π
on top of the standard cget, configure, identify element, instate, state and style commands (peep ttk::widget for those), radiobutton widgets also support this extra one:
pathname invokeβ sets the-variableto the-value, selects the widget, and evaluates the associated-command. It returns the result of the-command, or the empty string if no-commandis specified.
so like, invoke does the whole click experience for you. three-for-one special β¨
π WIDGET STATES π
- If the
disabledstate is set, the widget does not respond to user input. it's offline. do not perceive it π - The widget sets the
selectedstate whenever the linked-variableis set to the widget's-value, and clears it otherwise. - The widget sets the
alternatestate whenever the linked-variableis unset. (thealternatestate may be used to indicate a "tri-state" or "indeterminate" selection.) it's giving "idk yet" energy π
π STANDARD STYLES π
Ttk::radiobutton widgets support the Toolbutton style in all standard themes β which is super useful for creating widgets for toolbars. toolbar besties, this one's for you π«Ά
π STYLING OPTIONS π
The class name for a ttk::radiobutton is TRadiobutton.
Dynamic states: active, alternate, disabled, pressed, readonly, selected.
TRadiobutton styling options configurable with ttk::style are:
-backgroundcolor-compoundcompound-foregroundcolor-indicatorbackgroundcolor-indicatorcolorcolor-indicatormarginpadding-indicatorreliefrelief-paddingpadding
some options are only available for specific themes, so if one of these ghosts you, it's not you, it's the theme π
see the ttk::style manual page for info on how to configure ttk styles β¨
π SEE ALSO π
ttk::widget(3tk)ttk::checkbutton(3tk)radiobutton(3tk)
β KEYWORDS β
widget, button, option
and that's the whole page, bestie π this one's from Tk 8.5 β the ttk::radiobutton(3tk) page β so go forth, group your radiobuttons, set your -variable, and pick exactly one option like the main character you are ππ
periodt.
π¦ where this page comes from
- debian trixie: tk9.0-doc 9.0.1-3
- ubuntu questing: tk9.0-doc 9.0.2-1
- ubuntu resolute: tk9.0-doc 9.0.3-1
- ubuntu stonking: tk9.0-doc 9.0.4-1
- Copyright (c) 2004 Joe English
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms