pygame.init help - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Game Development (https://python-forum.io/forum-11.html) +--- Thread: pygame.init help (/thread-3269.html) |
pygame.init help - raichu4vuhs - May-10-2017 pygame.init() the internet tells me this is initializing a module. What does that mean? RE: pygame.init help - metulburr - May-10-2017 http://pygame.org/docs/tut/ImportInit.html init initializes all the modules for you in one line instead of doing this in every game. At the same time it initializes the modules in correct order. For example some platforms require mixer to initialize after display, etc. pygame.font.init() pygame.display.init() pygame.mixer.init() pygame.joystick.init() pygame.freetype.init() pygame.midi.init() pygame.cdrom.init() pygame.scrap.init()If you are making just an mp3 player, you dont need a display, so you dont have to initialize every module, you can just do pygame.mixer.init() for example. Or you may need to give specific values pygame.mixer.init(frequency=22050, size=-16, channels=2, buffer=4096) As for what init actually does you can look at the source mixer.init https://bitbucket.org/pygame/pygame/src/48e19c7b9ee902f54a7973d70394d2bea79c1fa5/src/mixer.c?at=default&fileviewer=file-view-default#mixer.c-315 RE: pygame.init help - kennybassett - May-18-2017 Ah I had the same question. Thanks! |