pyvista.Plotter.add_spline_widget#
- Plotter.add_spline_widget(callback, bounds=None, factor=1.25, n_handles=5, resolution=25, color='yellow', show_ribbon=False, ribbon_color='pink', ribbon_opacity=0.5, pass_widget=False, closed=False, initial_points=None, interaction_event=45)[source]#
Create and add a spline widget to the scene.
Use the bounds argument to place this widget. Several “handles” are used to control a parametric function for building this spline. Click directly on the line to translate the widget.
- Parameters:
- callback
callable() The method called every time the spline is updated. This passes a
pyvista.PolyDataobject to the callback function of the generated spline.- boundssequence[
float],optional Length 6 sequence of the bounding box where the widget is placed.
- factor
float,optional An inflation factor to expand on the bounds when placing.
- n_handles
int,optional The number of interactive spheres to control the spline’s parametric function.
- resolution
int,optional The number of points in the spline created between all the handles.
- color
ColorLike,optional Either a string, RGB sequence, or hex color string.
- show_ribbonbool,
optional If
True, the poly plane used for slicing will also be shown.- ribbon_color
ColorLike,optional Color of the ribbon. Either a string, RGB sequence, or hex color string.
- ribbon_opacity
float,optional Opacity of ribbon. Defaults to 1.0 and must be between
[0, 1].- pass_widgetbool,
optional If
True, the widget will be passed as the last argument of the callback.- closedbool,
optional Make the spline a closed loop.
- initial_pointssequence,
optional The points to initialize the widget placement. Must have same number of elements as
n_handles. If the first and last point are the same, this will be a closed loop spline.- interaction_event
vtk.vtkCommand.EventIds,optional The VTK interaction event to use for triggering the callback.
- callback
- Returns:
vtk.vtkSplineWidgetThe newly created spline widget.
Notes
This widget has trouble displaying certain colors. Use only simple colors (white, black, yellow).