anim.plane.polygon

class anim.plane.polygon(points, x=0, y=0, position=None, color='grey', stroke=None, thickness=0.005, linestyle='-', group=None, center_of_rotation=[0, 0], orientation=0, zvalue=0, draggable=False, clickable=False)

A polygon item is defined by its:

  • reference point

  • polygon points (locations relative to the point of reference)

  • styling

Parameters ══════════

  • name

    str The polygon’s name

  • group

    anim.plane.group default: None The polygon’s group. If None, the position of the reference point is in absolute coordinates. Otherwise, the positions are relative to the group’s reference point.

─── positions ───────────────────────────────

  • x

    float default: 0 x-position of the reference point.

  • y

    float default: 0 y-position of the reference point.

  • position

    (float, float), [float, float], complex default: [0,0] Position of the reference point. The user can define either x, y or the position. In case of conflict, the position attribute wins.

  • points

    [(float, float)], [[float, float]], [complex] Positions of the polygon points, with respect to the reference point

─── transformations ─────────────────────────

  • orientation

    float default: 0, unit: radians Orientation of the polygon, with respect to the positive part of the x-axis.

  • center_of_rotation

    (float, float), [float, float], complex default: None Center point for the rotation, relative to the reference point.

  • draggable

    bool default: False Boolean specifying if the item can be dragged. If True, the dragging callback is defined in the ‘itemChange’ method of the event class, which is transfered to the canva’s ‘event’ method (recommended).

─── stack ───────────────────────────────────

  • zvalue

    float default: 0 Z-value (stack order) of the polygon.

─── style ────────────────────────────────

  • color

    None, str, QColor default: ‘grey’ Fill color. None stands for transparency.

  • stroke

    None, str, QColor default: None Stroke color. None stands for transparency.

  • thickness

    float default: 0.005 Stroke thickness, in scene units. When it is equal to 0, the stroke has the minimal thickness of 1 pixel.

  • linestyle

    ‘solid’/’-’, ‘dash’/’–’, ‘dot’/’..’/’:’, ‘dashdot’/’-.’ default: ‘-’ Stroke style.

__init__(points, x=0, y=0, position=None, color='grey', stroke=None, thickness=0.005, linestyle='-', group=None, center_of_rotation=[0, 0], orientation=0, zvalue=0, draggable=False, clickable=False)

Path item constructor

Methods

Lx()

Ly()

__init__(points[, x, y, position, color, ...])

Path item constructor

initialize()

Initialize the path

rotate(angle)

Relative rotation

setColor()

Color styling

setGeometry()

Set the path geometry

setOrientation()

Set the qitem orientation

setPosition([position])

Sets the qitem's position.

setStroke()

Stroke styling

translate(dx[, dy])

Relative translation

Attributes

center_of_rotation

clickable

color

draggable

group

linestyle

orientation

points

position

stroke

thickness

x

y

zvalue