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.PlotterWidgetProvides 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:
- plotter
Plotter The plotter to add the tree menu widget to.
- position
tuple,optional The (x, y) position of the top-left corner of the menu. Default is (0.65, 0.95).
- button_size
int,optional Size of the checkbox buttons in pixels. Default is 20.
- spacing
int,optional Vertical spacing between items in pixels. Default is 30.
- font_size
int,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
- plotter
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#
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.