RenderWindowInteractor.style

Contents

RenderWindowInteractor.style#

property RenderWindowInteractor.style: vtkContextInteractorStyle | vtkInteractorStyle | InteractorStyleCaptureMixin | None[source]#

Get/set the current interactor style.

When set to a string, the name is resolved through the interactor style registry (equivalent to calling enable_interactor_style()).

Warning

Setting an interactor style needs careful control of events handling. See InteractorStyleCaptureMixin and its implementation as an example.

Returns:
outputvtkInteractorStyle | vtkContextInteractorStyle | None

The current interactor style.

Examples

Set interactor style by name.

>>> import pyvista as pv
>>> pl = pv.Plotter()
>>> pl.iren.style = 'terrain_style'

Set interactor style with a customized vtk interactor.

>>> from vtkmodules.vtkInteractionStyle import (
...     vtkInteractorStyleTrackballCamera,
... )
>>> class MyCustomInteractorStyle(vtkInteractorStyleTrackballCamera):
...     # Implement custom functionality
...     def __repr__(self):
...         return 'A custom interactor style.'
>>> pl = pv.Plotter()
>>> pl.iren.style = MyCustomInteractorStyle()
>>> pl.iren.style
A custom interactor style.