RectAnnotation module
- class lys.widgets.canvas.interface.RectAnnotation.RectAnnotation(canvas, pos, size, axis)[source]
Bases:
AnnotationWithLine
Interface to access rectangle annotations in canvas.
RectAnnotation is usually generated by addRectAnnotation method in canvas.
Several methods related to the appearance of line is inherited from
AnnotationData.AnnotationWithLine
- Parameters
canvas (Canvas) – canvas to which the line annotation is added.
pos (length 2 sequence) – The position of the rect annotation in the form of (x, y).
size (length 2 sequence) – The size of the rect annotation in the form of (width, height).
axis ('BottomLeft', 'BottomRight', 'TopLeft', or 'TopRight') – The axis to which the line annotation is added.
Example:
from lys import display g = display() rect = g.canvas.addRectAnnotation() rect.setLineColor("#ff0000")
- getPosition()[source]
Get position of the rectangle.
- Returns
The position of rectangle in the form of (x, y)
- Return type
length 2 sequence
- getRegion()[source]
Get region of the rectangle.
- Returns
The region of rectangle in the form of [(x1, x2), (y1, y2)]
- Return type
2*2 sequence
- getSize()[source]
Get size of the rectangle.
- Returns
The size of rectangle in the form of (width, height)
- Return type
length 2 sequence
- regionChanged
PyqtSignal that is emitted when the rectangle is changed.