Skip to content

Text

Inherits: Shape

Draws value with style at the given (x, y) point.

Properties

Properties#

alignment class-attribute instance-attribute #

alignment: Alignment = field(
    default_factory=lambda: TOP_LEFT
)

A point within a text rectangle to determine its position and rotation center.

ellipsis class-attribute instance-attribute #

ellipsis: Optional[str] = None

String used to ellipsize overflowing text.

max_lines class-attribute instance-attribute #

max_lines: Optional[int] = None

The maximum number of lines painted. Lines beyond this number are silently dropped. For example, if max_lines = 1, then only one line is rendered. If max_lines = None, but ellipsis != None, then lines after the first one that overflows the width constraints are dropped.

max_width class-attribute instance-attribute #

max_width: Optional[Number] = None

The maximum width of the painted text.

Defaults to None - infinity.

rotate class-attribute instance-attribute #

rotate: Number = 0

The rotation of this text in radians. Text is rotated around the point determined by alignment.

spans class-attribute instance-attribute #

spans: Optional[list[TextSpan]] = None

The list of TextSpan objects to build a rich text paragraph.

style class-attribute instance-attribute #

style: Optional[TextStyle] = None

A text style to draw text and spans with.

text_align class-attribute instance-attribute #

text_align: TextAlign = START

Text horizontal align.

value class-attribute instance-attribute #

value: Optional[str] = None

The text to draw.

x instance-attribute #

x: Number

The x-axis coordinate of the text's alignment point.

y instance-attribute #

y: Number

The y-axis coordinate of the text's alignment point.