Timer

class rumps.Timer(callback, interval)

Python abstraction of an Objective-C event timer in a new thread for application. Controls the callback function, interval, and starting/stopping the run loop.

Changed in version 0.2.0: Method __call__ removed.

Parameters:
  • callback – Function that should be called every interval seconds. It will be passed this rumps.Timer object as its only parameter.
  • interval – The time in seconds to wait before calling the callback function.
callback

The current function specified as the callback.

interval

The time in seconds to wait before calling the callback function.

is_alive()

Whether the timer thread loop is currently running.

set_callback(callback)

Set the function that should be called every interval seconds. It will be passed this rumps.Timer object as its only parameter.

start()

Start the timer thread loop.

stop()

Stop the timer thread loop.