79750181

Date: 2025-08-29 11:03:28
Score: 0.5
Natty:
Report link

Here is a small class which does exactly that from CrazySqueak's answer. So please upvote his answer not mine!

import threading

class AdvTimer():
    def __init__(self, interval, callback):
        self.interval = interval
        self.callback = callback

    def restart(self):
        self.timer.cancel()
        self.start()

    def start(self):
        self.timer = threading.Timer(self.interval, self.callback)
        self.timer.start()
Reasons:
  • Blacklisted phrase (0.5): upvote
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Thilo Cestonaro