Pygame font error
You never initialized pygame
and pygame.font
after importing:
# imports
pygame.init() # now use display and fonts
In order to use some pygame modules, either pygame or that specific module has to be initialised before you start using them - this is what the error message is telling you.
To initialize pygame:
import pygame
...
pygame.init()
To initialize a specific library (eg font):
import pygame
...
pygame.font.init()
In most cases, you will want to initialise all of pygame, so use the first version. In general, I would place this at the top of my code, just after importing pygame