pythontimepygamedelaysource-code-protection

Is pygame.time.delay() better than time.sleep()?


Is it wrong to think that pygame.time.delay(1000) is more accurate than time.sleep(1).

Does the pygame module use time.sleep() in its source code, or are they completely different?


Solution

  • PyGame is based on Simple DirectMedia Layer (SDL). pygame.time.delay() is delegated to SDL_Delay. The implementation of SDL_Delay depends on the operating system.