Timer — Timer handle

class pyuv.Timer(loop)
Parameters:loop (Loop) – loop object where this handle runs (accessible through Timer.loop).

A Timer handle will run the supplied callback after the specified amount of seconds.

start(callback, timeout, repeat)
Parameters:
  • callback (callable) – Function that will be called when the Timer handle is run by the event loop.
  • timeout (float) – The Timer will start after the specified amount of time.
  • repeat (float) – The Timer will run again after the specified amount of time.

Start the Timer handle.

Callback signature: callback(timer_handle).

stop()

Stop the Timer handle.

again()

Stop the Timer, and if it is repeating restart it using the repeat value as the timeout.

repeat

Get/set the repeat value. Note that if the repeat value is set from a timer callback it does not immediately take effect. If the timer was non-repeating before, it will have been stopped. If it was repeating, then the old repeat value will have been used to schedule the next timeout.

Previous topic

Handle — Handle base class

Next topic

TCP — TCP handle

This Page