I am trying to figure out how to change the font size of a specific line of text in my Pygame program.

I have used this:

font = pygame.font.Font(None, 40) 

To change the size to 40, however this changes all font sizes on the screen to 40, I want to be able to independently change the font sizes.

Any ideas?

Thanks,Alex

1

Best Answer


Create many fonts

 font_20 = pygame.font.Font(None, 20) font_40 = pygame.font.Font(None, 40) 

and then use different font with different text.

 text1 = font_20.render("Hello", ...)text2 = font_40.render("World", ...)