Text¶
-
class
plie.
Text
(text='', callout=None, justify='left', bounds=None, replace_whitespace=True)[source]¶ Bases:
object
Text is the universal class for dealing with all single text snippets.
Text helps with basic formatting, justification, word wrapping to the appropriate width and acts as a way to contain a block of text for applying styles to it or developing a layout.
Parameters: - text – the text to display (can be changed later
- callout – an attribute made available for storing a function, it is used if this Text object gets selected by some event.
- justify – specifies which justification the text should have, options are: ‘left’ where all the text aligns with the left edge, ‘center’ where all the text is centered in the middle of the, available space ‘right’ where all the text aligns with the right edge
- bounds – the bounding box for the Text object in screen space cells, will be set automatically by Renderer usually
Returns: an initialized Text object
-
as_cells
()[source]¶ Translates the internal state and translates it into a screen-space cell dict of size bounds
Returns: Dictionary with keys of format (x,y), of size bounds and single character strings as the values.
-
lines
¶ Returns: the number of lines that the Text instance uses