Skip to content

slider

Slider

Bases: Plot

Slider class for visualizing data over time and updating opacity.

Attributes:

Name Type Description
data dict

Dictionary of data to visualize.

builders dict

Dictionary of object builders.

visible_objects list

List of visible objects.

actors dict

Dictionary of pyvista actors.

plotter Plotter

PyVista plotter object.

current_time_index int

Current time index.

time_axis ndarray | None

Array of time values for the slider.

slider_widget

The PyVista slider widget instance.

current_time_index = 0 instance-attribute

slider_widget = None instance-attribute

time_axis = time_axis instance-attribute

__init__(time_axis)

Initialize the Slider.

Parameters:

Name Type Description Default
time_axis ndarray | None

Array of time values for the slider. If None, must be set before using time-dependent features.

required

add_time_slider()

Add a time slider widget to the plotter for time navigation.

key_press_callback(obj, event)

Handle key press events for time navigation in the slider.

Parameters:

Name Type Description Default
obj vtkObject

VTK object triggering the event.

required
event vtkEvent

VTK event.

required

show()

Show the slider window, initialize objects, sliders, and event handlers.

update_objects(time, prev_time=-1.0)

Update the objects in the slider for a given timestep.

Parameters:

Name Type Description Default
prev_time float

Previous timestep to update the objects for.

-1.0
time float

Current timestep to update the objects for.

required

update_time(value)

Update the slider to a specific time value.

Parameters:

Name Type Description Default
value float

Time to update the slider to.

required

update_time_by_index(index)

Update the slider to a specific time index.

Parameters:

Name Type Description Default
index int

Index of the time to update the slider to.

required