Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Timer + long-running callback expectations #29029

Copy link
Copy link
Open
@greglucas

Description

@greglucas
Issue body actions

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.