GUI Handles#
- class viser.GuiInputHandle[source]#
A handle is created for each GUI element that is added in
viser
. Handles can be used to read and write state.When a GUI element is added via
ViserServer.gui
, state is synchronized between all connected clients. When a GUI element is added viaClientHandle.gui
, state is local to a specific client.- on_update(func: Callable[[GuiEvent[TGuiHandle]], None]) Callable[[GuiEvent[TGuiHandle]], None] [source]#
Attach a function to call when a GUI input is updated. Happens in a thread.
- __post_init__() None #
We need to register ourself after construction for callbacks to work.
- Return type:
None
- property disabled: bool#
Allow/disallow user interaction with the input. Synchronized automatically when assigned.
- property order: float#
Read-only order value, which dictates the position of the GUI element.
- remove() None #
Permanently remove this GUI element from the visualizer.
- Return type:
None
- property update_timestamp: float#
Read-only timestamp when this input was last updated.
- property value: T#
Value of the GUI input. Synchronized automatically when assigned.
- property visible: bool#
Temporarily show or hide this GUI element from the visualizer. Synchronized automatically when assigned.
- class viser.GuiButtonHandle[source]#
Handle for a button input in our visualizer.
Lets us detect clicks.
- on_click(func: Callable[[GuiEvent[TGuiHandle]], None]) Callable[[GuiEvent[TGuiHandle]], None] [source]#
Attach a function to call when a button is pressed. Happens in a thread.
- __post_init__() None #
We need to register ourself after construction for callbacks to work.
- Return type:
None
- property disabled: bool#
Allow/disallow user interaction with the input. Synchronized automatically when assigned.
- property order: float#
Read-only order value, which dictates the position of the GUI element.
- remove() None #
Permanently remove this GUI element from the visualizer.
- Return type:
None
- property update_timestamp: float#
Read-only timestamp when this input was last updated.
- property value: T#
Value of the GUI input. Synchronized automatically when assigned.
- property visible: bool#
Temporarily show or hide this GUI element from the visualizer. Synchronized automatically when assigned.
- class viser.GuiButtonGroupHandle[source]#
Handle for a button group input in our visualizer.
Lets us detect clicks.
- on_click(func: Callable[[GuiEvent[TGuiHandle]], None]) Callable[[GuiEvent[TGuiHandle]], None] [source]#
Attach a function to call when a button is pressed. Happens in a thread.
- property disabled: bool#
Button groups cannot be disabled.
- __post_init__() None #
We need to register ourself after construction for callbacks to work.
- Return type:
None
- property order: float#
Read-only order value, which dictates the position of the GUI element.
- remove() None #
Permanently remove this GUI element from the visualizer.
- Return type:
None
- property update_timestamp: float#
Read-only timestamp when this input was last updated.
- property value: T#
Value of the GUI input. Synchronized automatically when assigned.
- property visible: bool#
Temporarily show or hide this GUI element from the visualizer. Synchronized automatically when assigned.
- class viser.GuiDropdownHandle[source]#
Handle for a dropdown-style GUI input in our visualizer.
Lets us get values, set values, and detect updates.
- property options: tuple[StringType, ...]#
Options for our dropdown. Synchronized automatically when assigned.
For projects that care about typing: the static type of
options
should be consistent with theStringType
associated with a handle. Literal types will be inferred where possible when handles are instantiated; for the most flexibility, we can declare handles asGuiDropdownHandle[str]
.
- __post_init__() None #
We need to register ourself after construction for callbacks to work.
- Return type:
None
- property disabled: bool#
Allow/disallow user interaction with the input. Synchronized automatically when assigned.
- on_update(func: Callable[[GuiEvent[TGuiHandle]], None]) Callable[[GuiEvent[TGuiHandle]], None] #
Attach a function to call when a GUI input is updated. Happens in a thread.
- property order: float#
Read-only order value, which dictates the position of the GUI element.
- remove() None #
Permanently remove this GUI element from the visualizer.
- Return type:
None
- property update_timestamp: float#
Read-only timestamp when this input was last updated.
- property value: T#
Value of the GUI input. Synchronized automatically when assigned.
- property visible: bool#
Temporarily show or hide this GUI element from the visualizer. Synchronized automatically when assigned.
- class viser.GuiFolderHandle[source]#
Use as a context to place GUI elements into a folder.
- property order: float#
Read-only order value, which dictates the position of the GUI element.
- class viser.GuiMarkdownHandle[source]#
Use to remove markdown.
- property content: str#
Current content of this markdown element. Synchronized automatically when assigned.
- property order: float#
Read-only order value, which dictates the position of the GUI element.
- property visible: bool#
Temporarily show or hide this GUI element from the visualizer. Synchronized automatically when assigned.
- class viser.GuiPlotlyHandle[source]#
Use to update or remove markdown elements.
- property figure: go.Figure#
Current content of this markdown element. Synchronized automatically when assigned.
- property aspect: float#
Aspect ratio of the plotly figure, in the control panel.
- property order: float#
Read-only order value, which dictates the position of the GUI element.
- property visible: bool#
Temporarily show or hide this GUI element from the visualizer. Synchronized automatically when assigned.
- class viser.GuiTabGroupHandle[source]#
Handle for a tab group. Call
add_tab()
to add a tab.- property order: float#
Read-only order value, which dictates the position of the GUI element.
- add_tab(label: str, icon: IconName | None = None) GuiTabHandle [source]#
Add a tab. Returns a handle we can use to add GUI elements to it.
- Parameters:
label (str) –
icon (IconName | None) –
- Return type: