ttk::radiobutton(n)

πŸ“¦
version 9.0.3 Β· 3 versions
, in alpine 3.23, alpine 3.24, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

✨ NAME ✨

okay so this is the ttk::radiobutton(n) page β€” Tk Themed Widget energy β€” and it’s all about a mutually exclusive option widget. bestie, it’s giving β€œpick one, not all of them” πŸ˜ŒπŸ’…


🌸 SYNOPSIS 🌸

ttk::radiobutton pathName ?options?

πŸ’– DESCRIPTION πŸ’–

ttk::radiobutton widgets are used in groups to show or change a set of mutually-exclusive options. Radiobuttons are linked to a Tcl variable, and have an associated value; when a radiobutton is clicked, it sets the variable to its associated value. that’s the whole vibe: click one, variable updates, group stays mutually exclusive. ✨


πŸŽ€ STANDARD OPTIONS πŸŽ€

the standard-options crew is:

  • -class
  • -compound
  • -cursor
  • -image
  • -state
  • -style
  • -takefocus
  • -text
  • -textvariable
  • -underline
  • -width

see the ttk_widget manual entry for details on the standard options. 🫢


πŸ¦‹ WIDGET-SPECIFIC OPTIONS πŸ¦‹

  • -command β€” Command-Line Name: -command; Database Name: command; Database Class: Command. A Tcl script to evaluate whenever the widget is invoked. πŸ”₯
  • -value β€” Command-Line Name: -value; Database Name: Value; Database Class: Value. The value to store in the associated -variable when the widget is selected. πŸ’–
  • -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. πŸ‘‘

🌈 WIDGET COMMAND 🌈

in addition to the standard cget, configure, identify element, instate, state, and style commands (see ttk::widget), radiobutton widgets support this extra command:

  • pathname invoke β€” sets the -variable to the -value, selects the widget, and evaluates the associated -command. Returns the result of the -command, or the empty string if no -command is specified. slay, that’s the whole 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 -variable is set to the widget’s -value, and clears it otherwise.

the widget sets the alternate state whenever the linked -variable is unset. (the alternate state may be used to indicate a β€œtri-state” or β€œindeterminate” selection.) πŸŒ€


🧚 STANDARD STYLES 🧚

Ttk::radiobutton widgets support the Toolbutton style in all standard themes, which is 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:

  • -background color
  • -compound compound
  • -foreground color
  • -indicatorbackground color
  • -indicatorcolor color
  • -indicatormargin padding
  • -indicatorrelief relief
  • -padding padding

some options are only available for specific themes. iykyk, theme-dependent behavior is real.

see the ttk::style manual page for information on how to configure ttk styles. 🎨


🌟 SEE ALSO 🌟

πŸ“ KEYWORDS πŸ“

widget, button, option


πŸ’– footer sign-off, bestie: source/version is Tk 8.5, manual is ttk::radiobutton(n), and the footer date slot isn’t listed in the original β€” so we’re not making one up, periodt. πŸ’–
πŸ“¦ where this page comes from