ttk::menubutton(3tk)
π ttk::menubutton β the widget that pops off (a menu) when you press it
okay bestie, welcome to the ttk::menubutton page from the Tk Themed Widget manual, section 3tk. she's cute, she's themed, she's literally a button whose whole personality is dropping a menu on you. let's get into it π«Ά
β¨ NAME β¨
ttk::menubutton β the widget that pops down a menu when pressed. that's it. that's her job. and she eats every time π
β¨ SYNOPSIS β¨
ttk::menubutton pathName ?options?
β¨ DESCRIPTION β¨
so a ttk::menubutton widget shows a textual label and/or an image (your choice, or both, live your truth), and when you press it β boom β she displays a menu. that's the whole vibe. no cap.
β¨ STANDARD OPTIONS β¨
these are the classics, the staples, the everyday icons. she's got:
-class-compound-cursor-image-state-style-takefocus-text-textvariable-underline-width
want the full lore on any of these? go read the ttk_widget manual entry, she explains everything π
β¨ WIDGET-SPECIFIC OPTIONS β¨
these are the options that make her her. main character energy only π
π -direction
- Command-Line Name:
-direction - Database Name:
direction - Database Class:
Direction
tells you where the menu pops up relative to the menubutton. pick one of: above, below, left, right, or flush. the default is below. and flush? iconic behaviour β she pops the menu up directly over the menubutton, no gap, no chill. π
π -menu
- Command-Line Name:
-menu - Database Name:
menu - Database Class:
Menu
this is where you hand her the path name of the menu she's associated with. and listen β to be on the safe side, that menu ought to be a direct child of the menubutton. like, keep your friends close and your child widgets closer, fr fr.
β¨ WIDGET COMMAND β¨
menubutton widgets come with the standard commands, all of them:
cgetconfigureidentify elementinstatestatestyle
(see ttk::widget for the details, she's got the receipts π)
β¨ STANDARD STYLES β¨
ttk::menubutton widgets support the Toolbutton style in all standard themes. which is super useful if you're out here creating widgets for toolbars β toolbar girlies, this one's for you π οΈβ¨
β¨ STYLING OPTIONS β¨
the class name for a ttk::menubutton is TMenubutton. remember it, she's famous.
Dynamic states: active, disabled, readonly.
TMenubutton styling options you can configure with ttk::style:
-arrowsizeamount-backgroundcolor-compoundcompound-foregroundcolor-fontfont-paddingpadding-reliefrelief-widthamount
heads up bestie: some of these are only available for specific themes π so don't come for me if one ghosts you in your theme.
for the full tea on configuring ttk styles, check the ttk::style manual page πΈ
β¨ SEE ALSO β¨
ttk::widget(3tk), menu(3tk), menubutton(3tk)
β¨ KEYWORDS β¨
widget, button, menu
okay that's the whole page, you absolutely ate this reading session π go forth and pop those menus π
this one's brought to you by Tk 8.5, and yes, she's still serving β ttk::menubutton(3tk) forever and always π¦β¨
π¦ 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