python - 让 PySide 与 matplotlib 一起工作

标签 python matplotlib pyside

我已尝试运行 example code on the SciPy website ,但我收到此错误:

Traceback (most recent call last):
  File ".\matplotlibPySide.py", line 24, in <module>
    win.setCentralWidget(canvas)
TypeError: 'PySide.QtGui.QMainWindow.setCentralWidget' called with wrong argument types:
  PySide.QtGui.QMainWindow.setCentralWidget(FigureCanvasQTAgg)
Supported signatures:
  PySide.QtGui.QMainWindow.setCentralWidget(PySide.QtGui.QWidget)

我正在构建一个最终将用于商业应用的简单科学数据记录器,因此我确实需要 PySide 的 LGPL 和绘图功能。有没有人有关于如何让它工作或替代绘图包或想法的经验?

提前致谢。

最佳答案

你提到的例子:

http://www.scipy.org/Cookbook/Matplotlib/PySide

有效,但您可能需要建议使用 PySide:

...
matplotlib.use('Qt4Agg')
matplotlib.rcParams['backend.qt4']='PySide'
import pylab
...

关于python - 让 PySide 与 matplotlib 一起工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6723527/

相关文章:

python - 在 Python 的 main() 中调用参数是不好的做法吗

python - Numpy 修改 ndarray 对角线

python - 应用程序包中的 PyInstaller Tkinter 窗口分辨率低,但应用程序中没有

python - 如何在 matplotlib 中更新 3D 箭头动画

python - Q进程执行时间

python - django mysql 所有数据都消失了

python - 使用matplotlib设置图例符号不透明度?

python - matplotlib 中带垂直线的图例

python - QWidget showFullScreen 产生多个resizeEvents

python - 从 CSV 文件填充 QTreeWidget - PySide/PyQt