SpinnerMenuDelegate#

class omni.kit.viewport.menubar.core.SpinnerMenuDelegate(
model: AbstractValueModel | None = None,
tooltip: str | None = None,
width: Length | None = None,
height: Length = 0,
min: float | int | None = None,
max: float | int | None = None,
step: float | int = 1,
enabled: bool = True,
text: bool = True,
icon_name: str | None = None,
icon_width: Length = 30,
icon_height: Length = 30,
use_in_menubar: bool = False,
precision: int | None = 1,
)#

Bases: MenuDelegate

A menu delegate that creates a spinner within a viewport menubar.

Use slider instead of spinner if omni.kit.widget.spinner not enabled.

Methods

__init__([model, tooltip, width, height, ...])

Constructor.

build_item(item)

Build a spinner.

destroy()

Release resources.

Attributes

enabled

Delegate enabled state.

__init__(
model: AbstractValueModel | None = None,
tooltip: str | None = None,
width: Length | None = None,
height: Length = 0,
min: float | int | None = None,
max: float | int | None = None,
step: float | int = 1,
enabled: bool = True,
text: bool = True,
icon_name: str | None = None,
icon_width: Length = 30,
icon_height: Length = 30,
use_in_menubar: bool = False,
precision: int | None = 1,
)#

Constructor.

Parameters:
  • model (Optional[ui.AbstractValueModel]) – Spinner data model, defaults to None

  • tooltip (Optional[str]) – Spinner tooltip, defaults to None.

  • width (Optional[ui.Length]) – Delegate width, defaults to None means ui.Fraction(1).

  • height (ui.Length) – Delegate Height, defaults to 0 means auto height.

  • min (Union[float, int, None]) – Spinner min value, defaults to None.

  • max (Union[float, int, None]) – Spinner max value, defaults to None.

  • step (Union[float, int]) – Spinner step value, defaults to 1.

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

  • text (bool) – Show text before spinner, defaults to True.

  • icon_name (Optional[str]) – Name of additional icon to be displayed before text, defaults to None means no additional icon.

  • icon_width (ui.Length) – Width of additional icon. Only available when icon_name is valid, defaults to 30 pixels.

  • icon_height (ui.Length) – Height of additional icon. Only available when icon_name is valid, defaults to 30 pixels.

  • use_in_menubar (bool) – Show menu item in menu bar, defaults to False.

  • precision (Optional[int]) – Data precision, defaults to 1.

build_item(item: MenuItem) → None#

Build a spinner.

Use slider instead if omni.kit.widget.spinner not enabled.

Parameters:

item (ui.MenuItem) – Menu item.

destroy() → None#

Release resources.

property enabled: bool#

Delegate enabled state.