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