PopupDialog#
- class omni.kit.window.popup_dialog.PopupDialog(
- width: int = 400,
- parent: Widget = None,
- title: str = None,
- ok_handler: Callable[[AbstractDialog], None] = None,
- cancel_handler: Callable[[AbstractDialog], None] = None,
- ok_label: str = 'Ok',
- cancel_label: str = 'Cancel',
- hide_title_bar: bool = False,
- modal: bool = False,
- warning_message: str | None = None,
Bases:
AbstractDialogBase class for a simple popup dialog with two primary buttons, OK and Cancel.
Methods
__init__([width, parent, title, ok_handler, ...])Inherited args from the base class.
destroy()Destructor
hide()Hides this dialog.
set_cancel_clicked_fn(cancel_handler)Sets function to invoke when Cancel button is clicked.
set_okay_clicked_fn(ok_handler)Sets function to invoke when Okay button is clicked.
show([offset_x, offset_y, parent, ...])Shows this dialog, optionally offset from the parent widget, if any.
Attributes
WINDOW_FLAGSGet position x of the dialog window.
Get position y of the dialog window.
Get the dialog window widget.
- __init__(
- width: int = 400,
- parent: Widget = None,
- title: str = None,
- ok_handler: Callable[[AbstractDialog], None] = None,
- cancel_handler: Callable[[AbstractDialog], None] = None,
- ok_label: str = 'Ok',
- cancel_label: str = 'Cancel',
- hide_title_bar: bool = False,
- modal: bool = False,
- warning_message: str | None = None,
Inherited args from the base class.
- Keyword Arguments:
width (int) – Window width. Default 400.
title (str) – Title to display. Default None.
ok_handler (Callable) – Function to invoke when Ok button clicked. Function signature: void okay_handler(dialog: PopupDialog)
cancel_handler (Callable) – Function to invoke when Cancel button clicked. Function signature: void cancel_handler(dialog: PopupDialog)
ok_label (str) – Alternative text to display on ‘Accept’ button. Default ‘Ok’.
cancel_label (str) – Alternative text to display on ‘Cancel’ button. Default ‘Cancel’.
warning_message (Optional[str]) – Warning message that will displayed in red with the warning glyph. Default None.
parent (omni.ui.Widget) – OBSOLETE.
- destroy()#
Destructor
- hide()#
Hides this dialog.
- set_cancel_clicked_fn(
- cancel_handler: Callable[[AbstractDialog], None],
Sets function to invoke when Cancel button is clicked.
- Parameters:
cancel_handler (Callable) – Callback with signature: void cancel_handler(dialog: PopupDialog)
- set_okay_clicked_fn(
- ok_handler: Callable[[AbstractDialog], None],
Sets function to invoke when Okay button is clicked.
- Parameters:
ok_handler (Callable) – Callback with signature: void okay_handler(dialog: PopupDialog)
- show(
- offset_x: int = 0,
- offset_y: int = 0,
- parent: Widget = None,
- recreate_window: bool = False,
Shows this dialog, optionally offset from the parent widget, if any.
- Keyword Arguments:
offset_x (int) – X offset. Default 0.
offset_y (int) – Y offset. Default 0.
parent (ui.Widget) – Offset from this parent widget. Default None.
recreate_window (bool) – Recreate popup window. Default False.
- property position_x#
Get position x of the dialog window.
- Returns:
int
- property position_y#
Get position y of the dialog window.
- Returns:
int
- property window#
Get the dialog window widget.
- Returns:
obj:’omni.ui.window’