Simple displayable text.
This is a convenience class for rendering strings of text. It takes care of caching the vertices so the text can be rendered every frame with little performance penalty.
Text can be word-wrapped by specifying a width to wrap into. If the width is not specified, it gives the width of the text as laid out.
Variables: |
|
---|
Warning
Deprecated. Use pyglet.text.Label.
Constructor:
Create displayable text.
Parameters: |
|
---|
Methods:
draw()
Attributes:
BASELINE Type: str BOTTOM Type: str CENTER Type: str LEFT Type: str RIGHT Type: str TOP Type: str color font halign Horizontal alignment of the text. height Height of the text. leading Vertical space between adjacent lines, in pixels. line_height Vertical distance between adjacent baselines, in pixels. text Text to render. valign Vertical alignment of the text. width Width of the text. x y z
Align the baseline of the first line of text with the given Y coordinate.
Align the bottom of the descender of the final line of text with the given Y coordinate.
Align the horizontal center of the text to the given X coordinate.
Align the left edge of the text to the given X coordinate.
Align the right edge of the text to the given X coordinate.
Align the top of the ascender of the first line of text with the given Y coordinate.
Horizontal alignment of the text.
The text is positioned relative to x and width according to this property, which must be one of the alignment constants LEFT, CENTER or RIGHT.
Type: | str |
---|
Height of the text.
This property is the ascent minus the descent of the font, unless there is more than one line of word-wrapped text, in which case the height takes into account the line leading. Read-only.
Type: | float |
---|
Vertical space between adjacent lines, in pixels.
Type: | int |
---|
Vertical distance between adjacent baselines, in pixels.
Type: | int |
---|
Text to render.
The glyph vertices are only recalculated as needed, so multiple changes to the text can be performed with no performance penalty.
Type: | str |
---|
Vertical alignment of the text.
The text is positioned relative to y according to this property, which must be one of the alignment constants BOTTOM, BASELINE, CENTER or TOP.
Type: | str |
---|
Width of the text.
When set, this enables word-wrapping to the specified width. Otherwise, the width of the text as it will be rendered can be determined.
Type: | float |
---|