constantly running a clock and trigger an other function for every 5 seconds.
Please give me idea how to do this.
Thanks a bunch
>>> import sched, time
>>> s = sched.scheduler(time.time, time.sleep)
>>> def print_time():
... s.enter(5, 1, print_time, ())
... print "From print_time", time.time()
...
>>> s.enter(0, 1, print_time, ())
Event(time=1265846894.4069381, priority=1, action=<function print_time at 0xb7d1ab1c>, argument=())
>>> s.run()
From print_time 1265846894.41
From print_time 1265846899.41
From print_time 1265846904.42
From print_time 1265846909.42
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With