DynamicTreeMenuWidget#

class ansys.tools.visualization_interface.backends.pyvista.widgets.dynamic_tree_menu.DynamicTreeMenuWidget(plotter: pyvista.Plotter, position: tuple = (0.82, 0.95), button_size: int = 20, spacing: int = 30, font_size: int = 6, dark_mode: bool = False)#

Bases: ansys.tools.visualization_interface.backends.pyvista.widgets.widget.PlotterWidget

Provides a dynamic tree menu with clickable buttons for each object.

This widget displays a hierarchical tree view of all plotted objects on the right side of the screen. Each object has a clickable checkbox button to toggle visibility.

Parameters:
plotterPlotter

The plotter to add the tree menu widget to.

positiontuple, optional

The (x, y) position of the top-left corner of the menu. Default is (0.65, 0.95).

button_sizeint, optional

Size of the checkbox buttons in pixels. Default is 20.

spacingint, optional

Vertical spacing between items in pixels. Default is 30.

font_sizeint, optional

Font size for the object labels. Default is 12.

dark_modebool, optional

Whether to use dark mode colors. Default is False. In light mode (False): text is black In dark mode (True): text is white

Notes

Each object gets a checkbox button that toggles visibility of the object and its subtree. The menu updates dynamically as objects are added or removed.

Overview#

refresh

Refresh the menu display.

update

Update the widget’s appearance for current dark mode setting.

show_menu

Show the menu by enabling all text actors and buttons.

hide_menu

Hide the menu by disabling all text actors and buttons.

callback

Placeholder callback (not used for this widget).

Import detail#

from ansys.tools.visualization_interface.backends.pyvista.widgets.dynamic_tree_menu import DynamicTreeMenuWidget

Method detail#

DynamicTreeMenuWidget.refresh()#

Refresh the menu display.

DynamicTreeMenuWidget.update()#

Update the widget’s appearance for current dark mode setting.

DynamicTreeMenuWidget.show_menu()#

Show the menu by enabling all text actors and buttons.

DynamicTreeMenuWidget.hide_menu()#

Hide the menu by disabling all text actors and buttons.

DynamicTreeMenuWidget.callback(state: bool) None#

Placeholder callback (not used for this widget).