Created
September 29, 2018 05:30
-
-
Save js2854/21253f8651320ed8c7908c9fc358139f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RepeatingTimer(_Timer): | |
def __init__(self, init_delay, interval, function, args=[], kwargs={}): | |
_Timer.__init__(self, interval, function, *args, **kwargs) | |
self.init_delay = init_delay | |
def run(self): | |
self.finished.wait(self.init_delay) | |
self.function(*self.args, **self.kwargs) | |
while not self.finished.is_set(): | |
self.finished.wait(self.interval) | |
self.function(*self.args, **self.kwargs) | |
self.finished.set() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment