add_line_widget

WidgetHelper.add_line_widget(callback, bounds=None, factor=1.25, resolution=100, color=None, use_vertices=False, pass_widget=False)

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
callbackcallable()

The method called every time the line is updated. This has two options: Take a single argument, the PolyData line (default) or if use_vertices=True, then it can take two arguments of the coordinates of the line’s end points.

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.

resolutionint, optional

The number of points in the line created.

colorstr or 3 item sequence, optional, defaults to white

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_widgetboollist

If True, the widget will be passed as the last argument of the callback.

Returns
vtk.vtkLineWidget

Created line widget.