sebo
sebo

Reputation: 1664

Running matplotlib with PyQt on Windows

I'm having trouble running matplotlib with PyQt on Windows 7.

When executing any code that uses these two libraries, even demo code such as: http://eli.thegreenplace.net/files/prog_code/qt_mpl_bars.py.txt

I get this error:

TypeError: 'PySide.QtGui.QWidget.setParent' called with wrong argument types:
  PySide.QtGui.QWidget.setParent(QWidget)
Supported signatures:
  PySide.QtGui.QWidget.setParent(PySide.QtGui.QWidget)
  PySide.QtGui.QWidget.setParent(PySide.QtGui.QWidget, PySide.QtCore.Qt.WindowFl
ags)

I'm using Python 2.7.5, matplotlib 1.2.1, and PyQt 4.10.3. All of these are 32-bit, running on my 64-bit OS. I've ran code which used matplotlib and PyQt separately with no issues.

I've tried the solution suggested in Getting PySide to work with matplotlib with no success.

Please help me track down this error.

Upvotes: 3

Views: 675

Answers (1)

tacaswell
tacaswell

Reputation: 87376

I am not clear if you want to use PySide or PyQt, but in either case the problem is you want to use one, but matplotlib is setting up the Qt4 backend using the other one, hence the confusing looking errors.

If you want to use PySide make sure

backend.qt4 : PySide        # PyQt4 | PySide

is in your matplotlibrc file.

If you want to use PyQt make sure

backend.qt4 : PyQt4        # PyQt4 | PySide

is in your matplotlibrc file.

Upvotes: 2

Related Questions