anim.plane.text¶
- class anim.plane.text(string='', center=(True, True), color='grey', fontname='Helvetica', fontsize=0.05, style='', group=None, x=0, y=0, position=None, center_of_rotation=[0, 0], orientation=0, zvalue=0, draggable=False, clickable=False)¶
A text item is defined by its:
position of the point of reference
- horizontal and vertical centering, with respect to the point of
reference. The defaut centering is (True,True), while (False,False) defines the reference as the bottom-left corner. One can also use a single value to set both at the same time.
styling: font and color
Parameters ══════════
- name
str The text item’s name
- string
str default: ‘’ The text’s string. HTML formatting is supported by default.
- group
anim.plane.group default: None The text item’s group. If None, the position of the reference point and center of rotation are in absolute coordinates. Otherwise, the position is relative to the group’s reference point.
─── position & transformations ──────────────
- 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.
- center
(bool, bool), [bool, bool], bool default: [True,True] Boolean Defining the centering around the reference point. For tuple and list the first element is for the x-axis and the second is for the y-axis.
- orientation
float default: 0, unit: radians Orientation of the text box, 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.
- 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 text box.
─── style ────────────────────────────────
- color
None, str, QColor default: ‘grey’ Fill color. None stands for transparency.
- fontname
str default: ‘Helvetica’ Font name
- fontsize
float default: 0.05 Font size, in scene units.
- style
str default: ‘’ Associated document’s css style sheet. Global styling is accessed through the html selector. Example: ‘html { background-color: yellow; }’
- __init__(string='', center=(True, True), color='grey', fontname='Helvetica', fontsize=0.05, style='', group=None, x=0, y=0, position=None, center_of_rotation=[0, 0], orientation=0, zvalue=0, draggable=False, clickable=False)¶
text item constructor
Methods
Lx()Ly()__init__([string, center, color, fontname, ...])text item constructor
initialize()Initialize the text item
rotate(angle)Relative rotation
setColor()Color styling
setFont()Set the font
setGeometry()Set the text box geometry
setOrientation()Set the text item orientation
setPosition()Override
translate(dx[, dy])Relative translation
Attributes
centercenter_of_rotationclickablecolordraggablefontnamefontsizegrouporientationpositionstringstylexyzvalue