pygfx.geometries.TextItem
- class pygfx.geometries.TextItem(text, font_props=None, *, ws_before='', ws_after='', nl_before='', nl_after='', allow_break=True)
Bases:
object
A formatted piece of text.
A text item represents a unit piece of text that is formatted in a specific way. The TextGeometry converts these into GlyphItem’s, and positions these so that they together display the intended total text.
- Parameters:
text (str) – The text to display.
font_props (textmodule.FontProps) – Format information for this text item.
ws_before (str) – Whitespace before the text.
ws_after (str) – Whitespace after the text.
nl_before (str) – Newline before the text.
nl_after (str) – Newline after the text.
allow_break (bool) – If True, allow a linebreak to be placed after this piece of text.
- property text
The text for this item.
- property font_props
The FontProps object to format this text item.
- property ws_before
The whitespace text in front of this item.
- property ws_after
The whitespace text after this item.
- property nl_before
The newline text in front of this item.
- property nl_after
The newline text after this item.
- property allow_break
Whether or not a line-break is allowed after this item.