WidgetHelper.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.

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.


The newly created distance widget.