ipygame.time
pygame-compatible time module.
get_ticks
Section titled “get_ticks”def get_ticks() -> intMilliseconds since pygame.init() was called.
def wait(milliseconds: int) -> intPause for milliseconds ms. Returns actual wait time.
def delay(milliseconds: int) -> intAccurate delay (same as wait in ipygame).
set_timer
Section titled “set_timer”def set_timer(event_type: int, millis: int = 0, loops: int = 0) -> NoneRepeatedly post event_type every millis ms.
Pass millis=0 to cancel an existing timer.
loops is the number of events to post (0 = infinite).
Clock Objects
Section titled “Clock Objects”class Clock()Frame-rate tracking and limiting, compatible with pygame.time.Clock.
__init__
Section titled “__init__”def __init__() -> Nonedef tick(framerate: int = 0) -> intUpdate the clock.
If framerate > 0 the method will sleep to keep the loop at that speed. Returns milliseconds since the last call.
tick_busy_loop
Section titled “tick_busy_loop”def tick_busy_loop(framerate: int = 0) -> intLike tick() but uses a busy loop for more accuracy.
get_time
Section titled “get_time”def get_time() -> intMilliseconds between the two most recent tick() calls.
get_rawtime
Section titled “get_rawtime”def get_rawtime() -> intLike get_time() but without sleep compensation.
get_fps
Section titled “get_fps”def get_fps() -> floatCompute the clock framerate (calls per second).
tick_async
Section titled “tick_async”async def tick_async(framerate: int = 0) -> intAsync version of tick() for Jupyter notebooks.
Uses asyncio.sleep() instead of time.sleep() so the
Jupyter kernel event loop can process widget messages (keyboard,
mouse, etc.) between frames.