tuxemon.ui.text module

class tuxemon.ui.text.TextArea(font, font_color, bg=(192, 192, 192))[source]

Bases: Sprite

Area of the screen that can draw text.

  • font (pygame.font.Font) –

  • font_color (ColorLike) –

  • bg (ColorLike) –

animated = True
Return type:


property text: str
tuxemon.ui.text.draw_text(surface, text, rect, *, justify='left', align='top', font, font_size=None, font_color=None)[source]

Draws text to a surface.

If the text exceeds the rect size, it will autowrap. To place text on a new line, put TWO newline characters (n) in your text.

  • text (str) – The text that you want to draw to the current menu item.

  • rect (Rect | Tuple[int, int, int, int]) – Area where the text will be placed.

  • justify (Literal['left', 'center', 'right']) – Left, center, or right justify the text.

  • align (Literal['top', 'middle', 'bottom']) – Align the text to the top, middle, or bottom of the menu.

  • font (Font) – Font to use to draw the text.

  • font_size (int | None) – Size of the font in pixels BEFORE scaling is done. Default: 4

  • font_color (Color | str | Tuple[int, int, int] | Tuple[int, int, int, int] | None) – Tuple of RGB values of the font _color to use.

  • surface (Surface) –

Return type: