tk_popup(3tk)

tk_popup3tk

Post a popup menu

Usage

tk_popup menu x y ?entry?


    


    


    

Overview

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. Menu is the name of a menu widget and 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.

Examples

How to attach a simple popup menu to a widget.

# 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 <1> {tk_popup .popupMenu %X %Y}

Keywords

menu, popup

Releases

18 releases since Debian 1.1 (Buzz); the text changed 8 times.

  1. 1.1–1.3
  2. 2.0–2.1
  3. 2.2–3.0
  4. 3.1–4.0
  5. 5.0
  6. 6.0
  7. 7
  8. 8–11
  9. 12–13

From tk8.6-doc 8.6.16-1 in Debian 13 (Trixie). Also shipped by tk9.0-doc. Parsed by carta from the page's man source.