May-10-2017, 07:01 AM
pygame.init() the internet tells me this is initializing a module. What does that mean?
pygame.init help
|
May-10-2017, 07:01 AM
pygame.init() the internet tells me this is initializing a module. What does that mean?
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/...ixer.c-315
Recommended Tutorials:
May-18-2017, 08:33 PM
(This post was last modified: May-18-2017, 08:33 PM by kennybassett.)
Ah I had the same question. Thanks!
|
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
pygame why init() & not __init__()? | ryfoa6 | 1 | 1,800 |
Apr-17-2020, 04:47 AM Last Post: buran |
|
pygame.mixer.init() devicename issue | wanhr | 2 | 4,730 |
Sep-15-2019, 09:08 AM Last Post: wanhr |