Why does the Pygame module need to be initialized (after importing) so you can properly use it?
Are there any other modules that need to be initialized?
How do you tell if you need to initialize a module or not?
Any answer to any question would be greatly appreciated 🙂
Pygame is not a module. It is a set of modules. There are multiple modules under Pygame.
pygame.init() does is to initialize all the modules in Pygame. Alternatively, if you initialize only one of the modules, you could do something like
pygame.font.init() to initialize just the font module.
With Pygame, you can initialize all modules. There aren’t many.
However, later on, in some cases, the libraries can be massive with a lot more modules, while our project might require only a few. Thus, we would only initialize the modules we need for the project. That is what initialization does, it tells the program what modules to load for us.
Answered By – Arthur H