1tk_popup(n) Tk Built-In Commands tk_popup(n)
2
3
4
5______________________________________________________________________________
6
8 tk_popup - Post a popup menu
9
11 tk_popup menu x y ?entry?
12_________________________________________________________________
13
14
16 This procedure posts a menu at a given position on the screen and con‐
17 figures Tk so that the menu and its cascaded children can be traversed
18 with the mouse or the keyboard. Menu is the name of a menu widget and
19 x and y are the root coordinates at which to display the menu. If
20 entry is omitted or an empty string, the menu's upper left corner is
21 positioned at the given point. Otherwise entry gives the index of an
22 entry in menu and the menu will be positioned so that the entry is
23 positioned over the given point.
24
26 How to attach a simple popup menu to a widget.
27 # Create a menu
28 set m [menu .popupMenu]
29 $m add command -label "Example 1" -command bell
30 $m add command -label "Example 2" -command bell
31
32 # Create something to attach it to
33 pack [label .l -text "Click me!"]
34
35 # Arrange for the menu to pop up when the label is clicked
36 bind .l <1> {tk_popup .popupMenu %X %Y}
37
38
40 bind(n), menu(n), tk_optionMenu(n)
41
42
44 menu, popup
45
46
47
48Tk 4.0 tk_popup(n)