Skip to main content

A loop timer instead of default one shot Timer from threading. Base on pythonTimer created by terryltang.

Project description

Python looping timer. Forked from terryltang/pythonTimer


pip install loopytimer

Feature & Usage

  • Require Python standard library: threading
  • Call a function after a specified number of seconds:
from loopytimer import LoopyTimer

timer = LoopyTimer(5.0, handler_func, args=[], kwargs={})
timer.set_call_limits(5)    # timer will run eternally if you don't set a limit
timer.cancel()     # cancel the timer's action if it's still waiting, will also destroy timer instance
  • Timer handler take positional arguments and keyword arguments:
timer = LoopyTimer(0.5, timer_handler, args=["Terry", "Tang"], kwargs={"city":"Houston", "state":"Texas"})
  • Cancel and destroy timer.
  • Add a customized logger function for timer handler.
  • Test cases included.


MIT License

Copyright (c) 2018 Wavky Huang


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for loopytimer, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size loopytimer-0.1.0-py2.py3-none-any.whl (5.1 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size loopytimer-0.1.0.tar.gz (4.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page