ttk::menubutton(n)

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

πŸ’… 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 name direction, database class Direction. This one specifies where the menu pops up relative to the menubutton. One of: above, below, left, right, or flush. The default is below. And flush pops the menu up directly over the menubutton β€” like, directly on top of it, no personal space 😭
  • -menu β€” database name menu, database class Menu. 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:

  • -arrowsize amount
  • -background color
  • -compound compound
  • -foreground color
  • -font font
  • -padding padding
  • -relief relief
  • -width amount

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


πŸ“ 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