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)#

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.


The method called every time the spline is updated. This passes a pyvista.PolyData object to the callback function of the generated spline.

boundstuple(float), optional

Length 6 tuple of the bounding box where the widget is placed.

factorfloat, optional

An inflation factor to expand on the bounds when placing.

n_handlesint, optional

The number of interactive spheres to control the spline’s parametric function.

resolutionint, optional

The number of points in the spline created between all the handles.

colorcolor_like, 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_colorcolor_like, optional

Color of the ribbon. Either a string, RGB sequence, or hex color string.

ribbon_opacityfloat, 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_eventvtk.vtkCommand.EventIds, optional

The VTK interaction event to use for triggering the callback.


The newly created spline widget.


This widget has trouble displaying certain colors. Use only simple colors (white, black, yellow).