pyvista.Plotter.add_measurement_widget#

Plotter.add_measurement_widget(callback=None, color=None)[source]#

Interactively measure distance with a distance widget.

Creates an overlay documenting the selected line and total distance between two mouse left-click interactions.

The measurement overlay stays on the rendering until the widget is deleted. Only one measurement can be added by each widget instance.

Parameters:
callbackCallable[[Tuple[float, float, float], [Tuple[float, float, float], int], float]

The method called every time the widget calculates a distance measurement. This callback receives the start point and end point as cartesian coordinate tuples and the calculated distance between the two points.

colorColorLike, optional

The color of the measurement widget.

Returns:
vtk.vtkDistanceWidget

The newly created distance widget.