Python Repeated Timer
Python-Repeated-Timer is an open-source & highly performing timer using only standard-libraries.
Users may change the interval
and duration
of the event as they wish.
This code is GUI freezing issue won't be happening, and performance of the timer won't be affected by any event.
Features:
- Python Repeated Timer is a open-source library based on Thread Timer, and this asynchronously triggers the event every N seconds.
- For this only uses python standard-library, no additional library is required.
- Easy to implement by simply using functions such as start(), stop(). Also, this timer is stable on multiple calls.
- No matter how heavy timer_tick() is, the timer's interval & duration won't be affected.
- It is possible to insert the argument so you can customize the timer as you want.
- You may change the interval & duration of the timer.
- No freezing issue occurs with GUI libraries such as Tkinter.
Install (~ing)
To install the current release:
$ pip install python-repeated-timer
Usage:
If you want to use a repeated timer in a python code, see this tutorials
$ python
>>> from repeated_timer import Repeated_Timer
>>> def timer_tick(remaining_time: int, *args: tuple, **kwargs: dict):
>>> # You can put your code in here
>>> print('timer tick!')
>>> print(remaining_time) # You can use remaining_time
>>>
>>> repeated_timer = Repeated_Timer(interval=1, duration=30, function=timer_tick, args1='args1')
>>> repeated_timer.start()
>>> # repeated_timer.stop()
Usage for GUI(with TKinter)
If you want to use repeated timer with tkinter, see this tutorials
Performance metrics:
this repository is still under construction.
TODO / Known Issues:
- this repository is still under construction.