How to embed matplotlib canvases in a PySide2 application

孤者浪人 提交于 2019-12-10 17:50:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!