def schedule_periodic(self, period, action, state=None):

        state = [state]

        def interval():
            state[0] = action(state[0])
            alarm[0] = self.master.after(period, interval)

        log.debug("timeout: %s", period)
        alarm = [self.master.after(period, interval)]

        def dispose():
            # nonlocal alarm
            self.master.after_cancel(alarm[0])

        return Disposable(dispose)
Schedules a periodic piece of work to be executed in the tkinter
dataset/ETHPy150Open ReactiveX/RxPY/rx/concurrency/mainloopscheduler/tkinterscheduler.py/TkinterScheduler.schedule_periodic