tk_optionMenu(n)

πŸ“¦
version 9.0.3 Β· 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

πŸ’– NAME πŸ’–

Okay bestie, welcome to tk_optionMenu(n) from the Tk Built-In Commands manual β€” this one is literally about creating an option menubutton and its menu. Slay. ✨

✨ SYNOPSIS ✨

tk_optionMenu pathName varName value ?value value ...?

πŸ¦‹ DESCRIPTION πŸ¦‹

So this procedure creates an option menubutton whose name is pathName, plus an associated menu. Together they let the user pick one of the values given by the value arguments. Iconic behavior, no cap. 🫢

The current value gets stored in the global variable whose name is given by varName, and it also gets displayed as the label in the option menubutton. The user can click on the menubutton to display a menu containing all of the values and thereby select a new value. Once a new value is selected, it will be stored in the variable and appear in the option menubutton. The current value can also be changed by setting the variable. πŸ’…

The return value from tk_optionMenu is the name of the menu associated with pathName, so that the caller can change its configuration options or manipulate it in other ways. Main character return value energy fr fr. πŸ‘‘

🌸 EXAMPLE 🌸

tk_optionMenu .foo myVar Foo Bar Boo Spong Wibble
pack .foo

πŸŽ€ KEYWORDS πŸŽ€

  • option menu

xoxo, your Tk bestie πŸ’œ β€” this page is serving Tk 4.0 source/version energy and it’s literally tk_optionMenu(n). πŸŽ€βœ¨

πŸ“¦ where this page comes from