The Pygame documentation says that pygame.init()
Initializes all pygame
modules which need to be initialized. What does it mean to initialize a Pygame module in Python.
I understand that pygame.init()
'starts everything up' but what is it meant by 'starts everything up'?
pygame.init()
does indeed initiate all Pygame modules. They don't come initiated or "started" when you import Pygame because starting every module when you import Pygame can make your code slow. By having to use pygame.init()
, your code will only run Pygame modules if you want it to.
You can also start specific modules in Pygame. pygame.mixer.init()
for example, only starts the mixer module in Pygame and not everything else.
Note that this is a Pygame feature, and .init()
is not for every module in Python. Some Pygame source code is run when you call pygame.init()
.