tk_popup(n)
π tk_popup(n) β popup menu main character energy π
okay bestie, welcome to tk_popup(n), a Tk Built-In Command that is literally here to post a popup menu. No cap, this is the little procedure that makes menus pop up where you want them and keeps Tk behaving so the whole menu situation can be navigated. π
πΈ NAME πΈ
tk_popupβ post a popup menu. That's the name, that's the vibe, periodt.
β¨ SYNOPSIS β¨
Here's the whole spell, bestie:
tk_popup menu x y ?entry?
π DESCRIPTION π
okay so the lore: this procedure posts a menu at a given position on the screen and configures Tk so that the menu and its cascaded children can be traversed with the mouse or the keyboard. iconic, honestly.
menu is the name of a menu widget. x and y are the root coordinates at which to display the menu.
If entry is omitted or an empty string, the menu's upper left corner is positioned at the given point. Otherwise, entry gives the index of an entry in menu, and the menu will be positioned so that the entry is positioned over the given point. slay. π
π EXAMPLE π
How to attach a simple popup menu to a widget. (main character behavior, fr fr.)
# Create a menu
set m [menu .popupMenu]
$m add command -label "Example 1" -command bell
$m add command -label "Example 2" -command bell
# Create something to attach it to
pack [label .l -text "Click me!"]
# Arrange for the menu to pop up when the label is clicked
bind .l <Button-1> {tk_popup .popupMenu %X %Y}
π¦ SEE ALSO π¦
go read these if you want the whole friend group, iykyk. π«Ά
π KEYWORDS π
menupopup
that's the whole page, bestie π β brought to you by Tk 4.0 and the tk_popup(n) manual page. The footer didn't print a date, so I'm not inventing one πβ¨
π¦ 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) 1994-1996 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms