AnyLumino
API referenceastryxsurfaces

ContextMenu

Attach a right-click menu to child widgets.

Menu items dispatch to Python the same way :class:DropdownMenu items do, through on_action and last_action.

JupyterLab installs its own context menu on notebook outputs, so a right click inside Lab opens both menus. Prefer :class:DropdownMenu or :class:MoreMenu for a notebook-facing menu, and reach for this one when the output is embedded somewhere Lab does not claim the event.

Notes

Functions

constructor__init__(items, children=None, *, size=None, menu_width=None, disabled=False, action_callbacks=None, **props) -> None
paramitemsIterable[Any]

Menu item records. Each item takes a label and a value, and may set disabled or {"type": "divider"}.

paramchildrenChildInput
= None

The widgets that respond to a right click.

paramsizestr | None
= None

Menu item size.

parammenu_widthint | None
= None

Fixed menu width in pixels.

paramdisabledbool
= False

Whether the menu is suppressed.

paramaction_callbacksIterable[Callable[[ComponentWidget, Any], None]] | None
= None

Python callbacks receiving the chosen item value.

parampropsAny
= {}

Returns

None

On this page