pygfx.objects.TextBlock
- class pygfx.objects.TextBlock(index, dirty_blocks)
Bases:
object
The TextBlock represents one block or paragraph of text.
Users can obtain instances of this class from the
MultiText
object.Text blocks are positioned using an entry in
text_object.geometry.positions
. TheText
object uses text blocks internally to do efficient re-layout when text is updated. With theMultiText
object the text blocks are positioned by the user or external code.- property index
The index in the geometry.positions buffer.
- set_text(text: str)
Set the text for this TextBlock (as a string).
This is called from
Text.set_text()
, but can also be called directly. Note that in contrast toText.set_text()
, setting the text on a TextBlock does not result in a re-layout (i.e. the bounding box is not updated until after the next draw).
- set_markdown(text: str)
Set the markdown for this TextBlock (as a string).
This is called from
Text.set_markdown()
, but can also be called directly. Note that in contrast toText.set_markdown()
, setting the text on a TextBlock does not result in a re-layout (i.e. the bounding box is not updated until after the next draw).