Note
Go to the end to download the full example code.
1D Point Widget#
A free-moving (x, y) control point on a 1-D panel, with an optional
crosshair. Unlike the vertical / horizontal line widgets it moves in both
directions, so it is handy as a draggable data cursor or a control handle for
an interactive fit. Add it with add_point_widget().
Snap the point onto the curve#
A pointer_move handler fires while the point is dragged. Here we read
point.x, look up the nearest sample, and push the point back onto the
curve with set() — a one-line “snap to data” cursor.
Total running time of the script: (0 minutes 1.438 seconds)