Learn Before
Code

Creating a Font Object in Pygame

You can create a font object with two different constructors: Font() and SysFont(). Font() requires a filename for the actual ttf font file you're using (or you can pass in None, in which case it will use the default system font), whereas SysFont() only requires the name of the font, since it draws from the fonts built into your system. Both fonts also have a parameter for the size of the font.

newFont = pygame.font.Font("times-new-roman.ttf", 15) newSysFont = pygame.font.Font("calibri", 20)

0

1

Updated 2021-08-02

Tags

Python Programming Language

Data Science