Menu
Create a menu, for use on a display's menu bar or as a pop-up.
Every Display has a menu bar at the top, which is intially empty. Menu items ("File", "Edit", etc.) can be added to it.
Menus can also be added to a display as pop-up menus (i.e., menus that appear when you press the right mouse button).
Creating a Menu
You can create a Menu using the following function:
Menu(title)
| Parameter | Type | Default | Description |
|---|---|---|---|
title |
str |
required | The menu's name, as shown on the menu bar. |
Once a menu is created, it can be populated using the addItem() and addItemList() functions.
Once created, you can add it to a Display using the Display's addMenu() or addPopupMen() function.
Functions
Once a Menu menu has been created, the following functions are available:
| Function | Description |
|---|---|
menu.addItem() |
Add an item to the menu. |
menu.addItemList() |
Add several items to the menu at once. |
menu.addSeparator() |
Add a separator line to the menu. |
menu.addSubmenu(menu) |
Add a submenu to the menu. |
menu.enable() |
Enable the menu, so its items can be selected. |
menu.disable() |
Disable the menu, graying it out so its items cannot be selected. |