ttk::button(3tk)
π ttk::button β the manual, but make it cute π
okay bestie, welcome to ttk::button, part of the Tk Themed Widget fam (that's the 3tk manual section, iykyk). this is the widget that's literally just a button. you press it. it does a thing. main character energy fr fr. π
β¨ NAME β¨
ttk::button β the widget that issues a command when pressed. that's it. that's the whole job. and it ate. π
β¨ SYNOPSIS β¨
ttk::button pathName ?options?
β¨ DESCRIPTION β¨
so a ttk::button widget shows a textual label and/or an image, and then β the moment of truth β it evaluates a command when pressed. that's the vibe. you click, it slays. π¦
β¨ STANDARD OPTIONS β¨
these are the standard ones, all chill and shared with the rest of the ttk crew:
-class-compound-cursor-image-justify-state-style-takefocus-text-textvariable-underline-width
ngl if you want the tea on what each of these actually does, go read the ttk_widget manual entry. it's all there, bestie. π
β¨ WIDGET-SPECIFIC OPTIONS β¨
these are the options that are hers. the ones only button gets to have. periodt. π
πΈ -command
- Command-Line Name:
-command - Database Name:
command - Database Class:
Command
a script to evaluate when the widget is invoked. that's the "does the thing when you click" option. the whole point, honestly.
πΈ -default
- Command-Line Name:
-default - Database Name:
default - Database Class:
Default
this one can be set to one of normal, active, or disabled. so here's the lore: in a dialog box, one button may be designated the "default" button β which roughly means "the one that gets invoked when the user presses <Enter>". π
active= this is currently the default button, she's the momentnormal= she may become the default button, she's keeping her options opendisabled= not defaultable, sorry bestie, not her era
the default is normal.
depending on the theme, the default button may be displayed with an extra highlight ring, or with a different border color. so she gets a little sparkle. β¨
β¨ WIDGET COMMAND β¨
on top of the standard cget, configure, identify element, instate, state and style commands (peep the ttk::widget manual for those), button widgets also support this extra one:
pathName invokeβ invokes the command associated with the button. it's literally just pressing the button with your code. no mouse required. iconic.
β¨ STANDARD STYLES β¨
Ttk::button widgets support the Toolbutton style in all standard themes, which is useful for creating widgets for toolbars. handy for when you're building a toolbar and need that look. π οΈ
in the Aqua theme there are several other styles which can be used to produce replicas of many of the different button types that are discussed in Apple's Human Interface Guidelines. these include:
DisclosureButtonDisclosureTriangleHelpButtonImageButtonInlineButtonGradientButtonRoundedRectButtonRecessedButton
like okay Apple, we see you. πβ¨
β¨ STYLING OPTIONS β¨
the class name for a ttk::button is TButton. remember that, it matters.
Dynamic states: active, disabled, pressed, readonly.
TButton styling options configurable with ttk::style are:
-anchoranchor-backgroundcolor-bordercolorcolor-compoundcompound-darkcolorcolor-foregroundcolor-fontfont-highlightcolorcolor-highlightthicknessamount-lightcolorcolor-paddingpadding-reliefrelief-shiftreliefamount-shiftreliefspecifies how far the button contents are shifted down and right in the pressed state. this action provides additional skeuomorphic feedback. yes she moves when you press her, that's the tactile little moment π«Ά
-widthamount
heads up: some options are only available for specific themes. don't come for me if your theme doesn't have them, that's just how it is bestie.
see the ttk::style manual page for information on how to configure ttk styles. π
β¨ SEE ALSO β¨
ttk::widget(3tk)button(3tk)
β¨ KEYWORDS β¨
widget, button, default, command
and that's the whole page, bestie! π this one's from Tk 8.5, and it's the ttk::button(3tk) manual β go forth and press buttons, you absolute icon. no cap. πβ¨ππ¦
π¦ 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