LineAnnotation module

class lys.widgets.canvas.interface.LineAnnotation.InfiniteLineAnnotation(canvas, pos, orientation, axis)[source]

Bases: AnnotationWithLine

Interface to access infinite line annotations in canvas.

InfiniteLineAnnotation is usually generated by addInfiniteLineAnnotation 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 (float) – The position of the line annotation.

  • type ('vertical' or 'horizontal') – The direction of the infinite line.

  • axis ('BottomLeft', 'BottomRight', 'TopLeft', or 'TopRight') – The axis to which the line annotation is added.

Example:

from lys import display
g = display()
line = g.canvas.addInfiniteLineAnnotation()
line.setLineColor("#ff0000")
getOrientation()[source]
getPosition()[source]

Get the position of the line.

Parameters

float – The position of the line.

positionChanged

PyqtSignal that is emitted when the position of the line is changed.

setPosition(pos)[source]

Set the position of the line.

Parameters

pos (float) – The position of the line.

class lys.widgets.canvas.interface.LineAnnotation.LineAnnotation(canvas, pos, axis)[source]

Bases: AnnotationWithLine

Interface to access line annotations in canvas.

LineAnnotation is usually generated by addLineAnnotation 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 (2 * 2 sequence) – The position of the line annotation.

  • axis ('BottomLeft', 'BottomRight', 'TopLeft', or 'TopRight') – The axis to which the line annotation is added.

Example:

from lys import display
g = display()
line = g.addLineAnnotation()
line.setLineColor("#ff0000")
getPosition()[source]

Get the position of the line.

Returns

The position of the line in the form of [(x0,y0),(x1,y1)].

Return type

2*2 sequence

positionChanged

PyqtSignal that is emitted when the position of the line is changed.

setPosition(pos)[source]

Set the position of the line.

Parameters

pos (2*2 sequence) – The position of the line in the form of [(x0,y0),(x1,y1)].