When calling timer.start(); timer.start() on an already running timer, the previous timer should be stopped before starting a new one. On the macosx backend this causes two timers to be running under the hood.
import time import matplotlib.pyplot as plt timer = plt.figure().canvas.new_timer(interval=1000) timer.add_callback(lambda: print(f"{time.ctime()}")) timer.start() timer.start() plt.pause(2)
4 prints, 2 per second
Tue Nov 5 09:07:27 2024 Tue Nov 5 09:07:27 2024 Tue Nov 5 09:07:28 2024 Tue Nov 5 09:07:28 2024
2 prints, 1 per second
Tue Nov 5 09:07:27 2024 Tue Nov 5 09:07:28 2024
No response
macos
main
macosx
None
Activity