I\'d like to implement a PyQtGraph PlotWidget into a PySide2 application. With PyQt5 everything works. With PySide2 I get the Error shown at the bottom. I already found out,
For anyone else getting errors with Point - I manually imported from 'PySide2.QtCore import QPoint' into the files giving me an error and changed Point to QPoint. Not anything official but fixes it for now.
View fix here https://github.com/pyqtgraph/pyqtgraph/pull/818/files
In the stable branch of pyqtgraph even PySide2 is not supported, so it is importing QtGui.QGraphicsView that must belong to PyQt4 or PySide since in PyQt5 and PySide2 QGraphicsView belongs to the submodule QtWidgets and not to QtGui.
In the develop branch, PySide2 support is being implemented, so if you want to use PySide2 you will have to install it manually using the following commands (you must first uninstall your installed pyqtgraph):
git clone -b develop git@github.com:pyqtgraph/pyqtgraph.git
sudo python setup.py install
Then you can use:
from PySide2 import QtWidgets
import pyqtgraph as pg
class WdgPlot(QtWidgets.QWidget):
def __init__(self, parent=None):
super(WdgPlot, self).__init__(parent)
layout = QtWidgets.QVBoxLayout(self)
pw = pg.PlotWidget()
pw.plot([1,2,3,4])
layout.addWidget(pw)
if __name__ == '__main__':
import sys
app = QtWidgets.QApplication(sys.argv)
w = WdgPlot()
w.show()
sys.exit(app.exec_())
More information in: