Clock: a clock with scheduled events

Clock: a clock with scheduled events

You can add new event like this

def my_callback(dt):
    pass

# call my_callback every 0.5 seconds
getClock().schedule_interval(my_callback, 0.5)

# call my_callback in 5 seconds
getClock().schedule_once(my_callback, 5)

If the callback return False, the schedule will be removed.

class pymt.clock.Clock

Bases: object

A clock object, that support events

get_fps()

Get the current FPS calculated by the clock

get_time()

Get the last tick made by the clock

schedule_interval(callback, timeout)

Schedule a event to be call every <timeout> seconds

schedule_once(callback, timeout=0)

Schedule an event in <timeout> seconds

tick()

Advance clock to the next step. Must be called every frame. The default clock have the tick() function called by PyMT

unschedule(callback)

Remove a previous schedule event

pymt.clock.getClock()

Return the clock instance used by PyMT

Previous topic

Cache Manager: cache object and delete them automaticly

Next topic

Config: base for PyMT configuration file

This Page