Clock object — Kivy v1.0.1-dev documentation

# Clock object

The `Clock` object allow you to schedule a function call. The scheduling can be repetitive or just once.

You can add new event like this:

    def my_callback(dt):
        pass

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

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

    # call my_callback as soon as possible (usually next frame.)
    Clock.schedule_once(my_callback)

Note

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

`kivy.clock.` `Clock`

  Instance of the ClockBase, available for everybody

class `kivy.clock.` `ClockBase`

  Bases: `object`

  A clock object, that support events

  `frametime`

    Time spended between last frame and current frame (in seconds)

  `get_fps`()

    Get the current FPS calculated by the clock

  `get_rfps`()

    Get the current “real” FPS calculated by the clock. This counter reflect the real frame displayed on the screen.

    In contrary to get_fps(), this function return a counter of the number of frame, not a average of frame per seconds

  `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 Kivy

  `tick_draw`()

    Tick the drawing counter

  `unschedule`(callback)

    Remove a previous schedule event