ipython / ipython

Official repository for IPython itself. Other repos in the IPython organization contain things like the website, documentation builds, etc.

Home Page:https://ipython.readthedocs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shell is already running a gui event loop for qt6, and plot fail show image

XIVN1987 opened this issue · comments

D:\Python38\vexe\Scripts>ipython --pylab
Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.12.3 -- An enhanced Interactive Python. Type '?' for help.
Installed qt6 event loop hook.
Shell is already running a gui event loop for qt6. Call with no arguments to disable the current loop.
Using matplotlib backend: QtAgg

In [1]: x = arange(0, 2*pi, pi/100)

In [2]: plot(x, sin(x))
qt.qpa.window: SetProcessDpiAwarenessContext() failed: 操作成功完成。
Qt's default DPI awareness context is DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2. If you know what you are doing, you can overwrite this default using qt.conf (https://doc.qt.io/qt-6/highdpi.html#configuring-windows).
Out[2]: [<matplotlib.lines.Line2D at 0x1708963c340>]

image window popup, but it is empty and hang. when close image window, ipython will exit.

I can reproduce using IPython < 8.24 but it is fixed in IPython >= 8.24 as part of the IPython/Matplotlib backend refactor. So if you upgrade to IPython >= 8.24 this will work. You will need to use at least Python 3.10 though.

I am closing this as no action is needed.