pyvista.plotting.widgets.WidgetHelper.add_line_widget#
- WidgetHelper.add_line_widget(callback, bounds=None, factor=1.25, resolution=100, color=None, use_vertices=False, pass_widget=False, interaction_event=45)[source]#
Add a line widget to the scene.
This is useless without a callback function. You can pass a callable function that takes a single argument, the PolyData line output from this widget, and performs a task with that line.
- Parameters:
- callback
callable() The method called every time the line is updated. This has two options: Take a single argument, the
PolyDataline (default) or ifuse_vertices=True, then it can take two arguments of the coordinates of the line’s end points.- bounds
tuple(float),optional Length 6 tuple of the bounding box where the widget is placed.
- factor
float,optional An inflation factor to expand on the bounds when placing.
- resolution
int,optional The number of points in the line created.
- color
ColorLike,optional Either a string, rgb sequence, or hex color string.
- use_verticesbool,
optional Changes the arguments of the callback method to take the end points of the line instead of a PolyData object.
- pass_widgetbool, default:
False If
True, the widget will be passed as the last argument of the callback.- interaction_event
vtk.vtkCommand.EventIds,optional The VTK interaction event to use for triggering the callback.
- callback
- Returns:
vtk.vtkLineWidgetCreated line widget.