Text

A brief reference to the Text class.

circle-info

Text extends the Renderable class but has some unique methods that are listed below.

Renderable Quick Reference Text Documentationarrow-up-right

Initialization

Text can be initialized like this:

text = Text(screen, text, x, y)
circle-info

There an extended constructor that contains most attributes, check the full documentation: Textarrow-up-right

Text

You can get or change the text displayed with:

text.text()  # Get the current text
text.text('new string!')  # Set new text

Dimensions

pyDraw will automatically calculate a width and height once you've created a Text object (or when you update it's attributes), so you can get those values like so:

text.width()
text.height()

Font

You can access the font of the text with:

Size

You can also modify the font-size as expected:

circle-exclamation

Align

You can specify an alignment for cases where multiple lines of text are given:

Possible Values (string):

  • left

  • center

  • right

Decorations

You can decorate text with the following methods:

Last updated