Reputation: 23
I have these code
FONT = pygame.font.Font("font/calibri.ttf", 50)
FONT.size = 25
but the compilter say
AttributeError: 'pygame.font.FONT' object attribute 'size' is read-only
I see no method help me change size. How can I do that?
Upvotes: 2
Views: 6617
Reputation: 101042
You can't change the size of an existing Font
object. You have to create a new Font
object with the size you want.
An alternative is the newer freetype
module. The render
methods of the Font
class in this module support text rendering using a different size.
Upvotes: 6