pyvista.RenderWindowInteractor.add_observer#
- RenderWindowInteractor.add_observer(event, call, interactor_style_fallback=True)[source]#
Add an observer for the given event.
- Parameters:
- event
str
|int
The event to observe. Either the name of this event (string) or a VTK event identifier (int).
- call
callable()
Callback to be called when the event is invoked.
- interactor_style_fallbackbool
If
True
, the observer will be added to the interactor style in cases known to be problematic.
- event
- Returns:
int
The identifier of the added observer.
Examples
Add a custom observer.
>>> import pyvista as pv >>> pl = pv.Plotter() >>> obs_enter = pl.iren.add_observer('EnterEvent', lambda *_: print('Enter!'))