问题
I am trying to embed a matplotlib canvas into a PySide2 application. I have tried to use this example: https://matplotlib.org/examples/user_interfaces/embedding_in_qt5.html
The example runs fine using PyQt5. However, if I change line 19 from
from PyQt5 import QtCore, QtWidgets
into
from PySide2 import QtCore, QtWidgets
then Python crashes with the message
Fatal Python error: deallocating None
as soon as the application window is closed. Is there any way to get this working properly using PySide2?
回答1:
It turns out that this was a bug in PySide2, which now has been fixed (see https://bugreports.qt.io/browse/PYSIDE-632?gerritReviewStatus=All). Just update to the most current version to get rid of the problem.
来源:https://stackoverflow.com/questions/49343679/how-to-embed-matplotlib-canvases-in-a-pyside2-application