OptionsMenuWidget#

class omni.kit.window.popup_dialog.OptionsMenuWidget(
title: str = None,
field_defs: List[OptionsMenuFieldDef] = [],
value_changed_fn: Callable = None,
build_ui: bool = True,
)#

Bases: object

A simple checkbox widget with a set of options. As opposed to the menu class, the widget can be combined with other widget types in the same window.

Keyword Arguments:
  • title (str) – Title of this menu. Default None.

  • field_defs ([OptionsDialog.FieldDef]) – List of FieldDefs. Default [].

  • value_changed_fn (Callable) – This callback is triggered on any value change.

  • build_ui (bool) – Build ui when created.

Note

OptionsMenu.FieldDef:

A namedtuple of (name, label, glyph, default) for describing the options field, e.g. OptionsDialog.FieldDef(“option”, “Option”, None, True).

Methods

__init__([title, field_defs, ...])

build_ui()

destroy()

Destructor.

get_value(name)

Returns value of the named field.

get_values()

Returns all values in a dictionary.

reset_values()

Resets all values to their defaults.

set_value(name, value)

Sets the value of the named field.

__init__(
title: str = None,
field_defs: List[OptionsMenuFieldDef] = [],
value_changed_fn: Callable = None,
build_ui: bool = True,
)#
destroy()#

Destructor.

get_value(name: str) bool#

Returns value of the named field.

Parameters:

name (str) – Name of the field.

Returns:

bool

get_values() dict#

Returns all values in a dictionary.

Returns:

dict

reset_values()#

Resets all values to their defaults.

set_value(name: str, value: bool)#

Sets the value of the named field.

Parameters:
  • name (str) – Name of the field.

  • value (bool) – New value