IconMenuDelegate#

class omni.kit.viewport.menubar.core.IconMenuDelegate(
name: str,
text: bool = False,
width: Length = 30,
height: Length = 30,
has_triangle: bool = True,
triangle_size: float = 6,
checked: bool = False,
enabled: bool = True,
triggered_fn: Callable[[None], None] = None,
right_clicked_fn: Callable[[None], None] = None,
tooltip: str | None = None,
build_custom_widgets: Callable[[MenuItem], None] = None,
)#

Bases: MenuDelegate

A menu delegate that creates icon and optionally text within a viewport menubar.

Methods

__init__(name[, text, width, height, ...])

Constructor.

build_item(item)

Build icon with optional drop-down carrot and label.

destroy()

Release resources.

Attributes

checked

Delegate checked state.

enabled

Delegate enabled state.

text

Label text

text_size

Label size.

text_visible

Label visibility.

__init__(
name: str,
text: bool = False,
width: Length = 30,
height: Length = 30,
has_triangle: bool = True,
triangle_size: float = 6,
checked: bool = False,
enabled: bool = True,
triggered_fn: Callable[[None], None] = None,
right_clicked_fn: Callable[[None], None] = None,
tooltip: str | None = None,
build_custom_widgets: Callable[[MenuItem], None] = None,
)#

Constructor.

Parameters:
  • name – (str): Icon Name of “Menu.Item.Icon” in UI style definition.

  • text (bool) – Show text before icon, defaults to False.

  • width (ui.Length) – Delegate width, defaults to 30 pixels.

  • height (ui.Length) – Delegate height, defaults to 30 pixels.

  • has_triangle (bool) – Show drop-down carrot, defaults to True.

  • triangle_size (float) – Size of drop-down carrot, defaults to 6 pixels.

  • checked (bool) – Delegate checked state, defaults to False.

  • enabled (bool) – Delegate enabled state, defaults to True.

  • triggered_fn (Callable[[None], None]) – Callback when menu item clicked, defaults to None.

  • right_clicked_fn (Callable[[None], None]) – Callback when right click on this menu item, defaults to None.

  • tooltip (Optional[str]) – Delegate tooltip, Default None means no tooltip.

  • build_custom_widget (Callable[[ui.MenuItem], None]) – Callback to build more widgets, defaults to None.

build_item(item: MenuItem) None#

Build icon with optional drop-down carrot and label.

Parameters:

item (ui.MenuItem) – Menu item.

destroy()#

Release resources.

property checked: bool#

Delegate checked state.

property enabled: bool#

Delegate enabled state.

property text: str#

Label text

property text_size: float#

Label size.

property text_visible: bool#

Label visibility.