Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Add a draw during show for macos backend#27955
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Without this a stale figure is shown
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.
Thanks for the pointer about this needing to be run in a terminal and not a script. I can reproduce the original issue that way.
This fixes the issue, so has my approval and is good to go in. But I am still not sure whether there is a deeper issue here with the way we are setting the interrupt handling that this is just covering up in a sense by forcing another event through.
In the__init__
method, we are actually following the call toself.show()
with adraw_idle()
. I'm wondering if we can either remove that call now, or if we should just be callingdraw_idle()
here regardless of whether we are stale or not like above.
matplotlib/lib/matplotlib/backends/backend_macosx.py
Lines 159 to 161 in1174aad
ifmpl.is_interactive(): | |
self.show() | |
self.canvas.draw_idle() |
Ping for second review here, I'd like to get this in for 3.8.4, which I would like to get out soon for np2 reasons. I'm not too concerned about potentially doubling up draw_idle requests here, as they are intentionally pretty cheap in the first place. I am more interested in getting the fix in than tracking down if other calls could possibly be omitted. I think it is likely correct that we could omit the call in |
…955-on-v3.8.xBackport PR#27955 on branch v3.8.x (Add a draw during show for macos backend)
Without this a stale figure is shown
PR summary
This is basically the same concept as what happens just before show in
plt.pause
.Essentially, there is nothing in the macos backend that actually causes a stale figure to be redrawn on
show
.Other backends (qt, tk in particular, but likely others) seem to be saved by the fact that a resize event is triggered upon show, but macos does not do the same.
Other ideas considered, would be to do this in
plt.show
(which would perhaps leave out some other mechanisms, such as mpl-gui) or to try and do this in backend_bases (which is hard because most do not callsuper
).Could also leave out the condition and just always call
draw_idle
.closes#27953
PR checklist