Skip to main content

Text

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

Inherits: canvas.Shape

Properties

  • alignment - A point within a text rectangle to determine its position and rotation center.
  • ellipsis - String used to ellipsize overflowing text.
  • max_lines - The maximum number of lines painted.
  • max_width - The maximum width of the painted text.
  • rotate - The rotation of this text in radians.
  • spans - The list of TextSpan objects to build a rich text paragraph.
  • style - A text style to draw text and spans with.
  • text_align - Text horizontal align.
  • value - The text to draw.
  • x - The x-axis coordinate of the text's alignment point.
  • y - The y-axis coordinate of the text's alignment point.

Properties

alignmentclass-attributeinstance-attribute

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

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

ellipsisclass-attributeinstance-attribute

ellipsis: Optional[str] = None

String used to ellipsize overflowing text.

max_linesclass-attributeinstance-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_widthclass-attributeinstance-attribute

max_width: Optional[Number] = None

The maximum width of the painted text.

Defaults to None - infinity.

rotateclass-attributeinstance-attribute

rotate: Number = 0

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

spansclass-attributeinstance-attribute

spans: Optional[list[TextSpan]] = None

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

styleclass-attributeinstance-attribute

style: Optional[TextStyle] = None

A text style to draw text and spans with.

text_alignclass-attributeinstance-attribute

text_align: TextAlign = TextAlign.START

Text horizontal align.

valueclass-attributeinstance-attribute

value: Optional[str] = None

The text to draw.

xinstance-attribute

x: Number

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

yinstance-attribute

y: Number

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