Description
Do we want to say anything about how we expect our event timers to behave with regard to when they fire? Should a timer be ticking continuously and firing when requested regardless of other tasks occurring (maybe in a separate thread), or should the timers fire at (time in callback + interval)?
Following up with some results about what the various backends currently do for callbacks that last longer than the timers with the following test script that will either print ~1/second or every 2-seconds.
import time
import matplotlib.pyplot as plt
fig = plt.figure()
def on_timer():
print(time.ctime())
time.sleep(1)
timer = fig.canvas.new_timer(interval=1000)
timer.add_callback(on_timer)
timer.start()
fig.canvas.start_event_loop(10)
macos: 2-seconds
tkagg: 2-seconds
qtagg: 1-second
gtk4agg: 1-second
wxagg: 2-seconds
So I can't say we have a standard right now, or if we should even try to set an expectation of one or the other cases to make things consistent.
Originally posted by @greglucas in #29023 (comment)