Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 455 Bytes

README.md

File metadata and controls

20 lines (14 loc) · 455 Bytes

recurring task

Virtually the same concept of JavaScript's setInterval but for Python.

# examples/greet.py

from recurring_task import RecurringTask

# create a recurring task that prints "Hello world!" every 2 seconds
# note that this won't start the task
t = RecurringTask(2, lambda: print("Hello world!"))

# start is non-blocking, the task run in its own thread
t.start() 

# stop the task when you're done
t.cancel()