Don't call QApplication.setQuitOnLastWindowClosed(False).#1142
Don't call QApplication.setQuitOnLastWindowClosed(False).#1142blink1073 merged 1 commit intoipython:mainfrom
Conversation
That setting previously caused
`plt.plot(); print("pre"); plt.show(block=True); print("post")`
to block after the `show()` call *even* after closing the Matplotlib
figure window ("post" was never printed).
The new behavior (printing "post" after the window is closed) is
consistent with plain IPython.
The setQuitOnLastWindowClosed call came in (with no additional
explanation) in the very first commit implementing qt support (bec2d41,
in 2010) and seems to have never been touched since then.
|
Thanks @anntzer for taking a look at this problem! I tested your PR locally and it worked as expected for me on Linux. Did you test it on Windows? If not, I can ask one of the Spyder devs to do it just to be extra sure.
It was probably needed in the old Qt4 days, but it seems to not be anymore. |
Not directly (it's a bit tricky for me to access a Windows dev setup), but I did check that on Windows, in the Spyder console, I can run QApplication.instance().setQuitOnLastWindowClosed(False) (effectively undoing the setting from ipykernel) and then plt.show(block=False) does work as desired. |
|
Ok, then this looks good to me. |
That setting previously caused
plt.plot(); print("pre"); plt.show(block=True); print("post")to block after theshow()call even after closing the Matplotlib figure window ("post" was never printed).The new behavior (printing "post" after the window is closed) is consistent with plain IPython.
The setQuitOnLastWindowClosed call came in (with no additional explanation) in the very first commit implementing qt support (bec2d41, in 2010) and seems to have never been touched since then.
This should close #4367 (which is really an ipykernel issue per spyder-ide/spyder#4367 (comment)), which had previously been closed as "can't fix, workaround available". Attn @ccordoba12 who commented on the spyder issue.