Getting PySide to work with matplotlib


Question

I have tried running the example code on the SciPy website, but I get this error:

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)

I am building a simple scientific data logger that will eventually be used in commercial applications, so I really need both the LGPL from PySide and plotting functionality. Does anyone have experience on how to get this to work or alternative plotting packages or ideas?

Thanks in advance.

1
21
7/17/2011 11:28:57 AM

The example that you mention:

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

works, but you might need to suggest the use of PySide:

...
matplotlib.use('Qt4Agg')
matplotlib.rcParams['backend.qt4']='PySide'
import pylab
...
31
11/28/2011 8:05:25 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon