add_line_widget#
- WidgetHelper.add_line_widget(callback, bounds=None, factor=1.25, resolution=100, color=None, use_vertices=False, pass_widget=False)[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
PolyData
line (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
color_like
,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_widget
boollist
If
True
, the widget will be passed as the last argument of the callback.
- callback
- Returns
vtk.vtkLineWidget
Created line widget.