-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Remove start_event_loop_default. Let pause() run the event loop for all backends. #8867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
lib/matplotlib/backend_bases.py
Outdated
loop so that interactive functions, such as ginput and | ||
waitforbuttonpress, can wait for events. | ||
Such an event loop is used by interactive functions, such as ginput and | ||
waitforbuttonpress, to wait for events. This should not be confused |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think this is correct, the GUI event loop is not always running.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to edit the message and force push if you'd like to.
@anntzer force-pushed to this branch. |
There's no benefit to the end user to having a deprecation warning in start_event_loop (which gets called e.g. by ginput) -- it's essentially just there to let the devs know that they could implement a more efficient (GUI toolkit-dependent) version. So just provide the default implementations instead and add a note that GUI toolkits may override them. flush_events doesn't need to raise by default, it can just return nothing for non-interactive backends.
The default `start_event_loop` is not as efficient as it could be for non-interactive backends (it runs a busy loop) but if you really care you should just call time.sleep in that case. Meanwhile, this avoids the need for third-party interactive backends to register themselves into rcsetup.interactive_bk in order to be correctly pause()able.
Rebased. |
Marking this as release critical only on the basis of "it would be nice to have it for mpl_cairo (specifically not needing to register itself into interactive_bk), and it's already been approved once" -- so just hoping to catch another core dev's attention. Feel free to untag if you disagree. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good simplification.
I will leave this for @tacaswell to decide whether to backport for 2.1. |
Remove start_event_loop_default. Let pause() run the event loop for all backends.
Backported to v2.1.x as 35af6c0 |
First commit: Move start_event_loop_default to start_event_loop.
There's no benefit to the end user to having a deprecation warning in
start_event_loop (which gets called e.g. by ginput) -- it's essentially
just there to let the devs know that they could implement a more
efficient (GUI toolkit-dependent) version. So just provide the default
implementations instead and add a note that GUI toolkits may override
them.
flush_events doesn't need to raise by default, it can just return
nothing for non-interactive backends.
Second commit: Let pause always run the event loop.
The default
start_event_loop
is not as efficient as it could be fornon-interactive backends (it runs a busy loop) but if you really care
you should just call time.sleep in that case.
Meanwhile, this avoids the need for third-party interactive backends to
register themselves into rcsetup.interactive_bk in order to be correctly
pause()able.