anyplotlib.RectangleWidget#
- class anyplotlib.RectangleWidget(push_fn, *, x, y, w, h, color='#00e5ff', linewidth=2, show_handles=True, max_extent=None)[source]#
Bases:
WidgetDraggable rectangle overlay widget for 2-D plots.
- Parameters:
push_fn (Callable) – Update callback.
x (float) – Top-left corner position in pixel/data coordinates.
y (float) – Top-left corner position in pixel/data coordinates.
w (float) – Width and height in pixel/data coordinates.
h (float) – Width and height in pixel/data coordinates.
color (str, optional) – CSS colour for the rectangle outline. Default
"#00e5ff".linewidth (float, optional) – Outline stroke width in px. Default 2.
show_handles (bool, optional) – Draw the corner grab handles. Default
True.max_extent (float or (float, float), optional) –
Maximum width/height in the widget’s coordinates. A scalar caps both axes; a
(max_w, max_h)pair caps them separately. When set, the rectangle physically stops growing at the cap while dragging — the dragged corner pins and the opposite corner stays put.None(default) leaves it unbounded.Use this when the rectangle’s area costs real work downstream — e.g. an integrating ROI whose size is a number of frames to read.