ttk::menubutton(n)
π ttk::menubutton(n) β the little button that pops a whole menu
okay so bestie, welcome to the ttk::menubutton page from the Tk Themed Widget manual β yes that's the manual name, we're not hiding it, it's literally right there π. This widget is lowkey iconic: you press it, a menu drops down. That's the whole vibe. Let's get into it β¨
πΈ NAME
ttk::menubutton β a widget that pops down a menu when pressed π
β SYNOPSIS
ttk::menubutton pathName ?options?
π¦ DESCRIPTION
So a ttk::menubutton widget shows a textual label and/or an image, and when you press it, it displays a menu. That's it, that's the whole personality. Main character energy, honestly π
β¨ STANDARD OPTIONS
Here's the standard-options lineup, no cap, every single one:
-class-compound-cursor-image-state-style-takefocus-text-textvariable-underline-width
For the details on all of these, go read the ttk_widget manual entry β it's giving encyclopedia, but make it useful π«Ά
π WIDGET-SPECIFIC OPTIONS
These are the ones that are hers, y'know? π
-directionβ database namedirection, database classDirection. This one specifies where the menu pops up relative to the menubutton. One of:above,below,left,right, orflush. The default isbelow. Andflushpops the menu up directly over the menubutton β like, directly on top of it, no personal space π-menuβ database namemenu, database classMenu. This specifies the path name of the menu associated with the menubutton. And to be on the safe side, the menu ought to be a direct child of the menubutton β like, keep your menu in the family, fr fr π
π WIDGET COMMAND
Menubutton widgets support the standard commands cget, configure, identify element, instate, state and style (see ttk::widget). All the classics, slay π
π§ STANDARD STYLES
Ttk::menubutton widgets support the Toolbutton style in all standard themes, which is useful for creating widgets for toolbars. Toolbar girls, this one's for you β
π STYLING OPTIONS
The class name for a ttk::menubutton is TMenubutton. Remember it, it's on the test π
Dynamic states: active, disabled, readonly. Those are the moods she can be in π
TMenubutton styling options configurable with ttk::style are:
-arrowsizeamount-backgroundcolor-compoundcompound-foregroundcolor-fontfont-paddingpadding-reliefrelief-widthamount
Some options are only available for specific themes β so like, don't come for her if a theme doesn't have your fave π
See the ttk::style manual page for information on how to configure ttk styles. It's giving "go read the docs", but lovingly π
π₯ SEE ALSO
ttk::widget(n)menu(n)menubutton(n)
π KEYWORDS
widget, button, menu
ngl bestie, the whole plot is: press the button, menu appears, you pick a thing. Everything else is just styling and vibes. You got this π«Άπ
β¨ and that's the page! β¨ brought to you by Tk 8.5, straight from the ttk::menubutton(n) manual β mwah, go build something iconic π
π
π¦ 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