AttributeError: module 'pyqtgraph.Qt.QtGui' has no attribute 'QApplication'."

6.1k views Asked by At

Details about my system;

Ubunttu 22.04.2 LTS x86_64

pyqtgraph v0.13.1

pyhton v3.10

The code I'm trying to run on line 56;

from pyqtgraph.Qt import QtGui, QtCore
import pyqtgraph as pg
app = QtGui.QApplication([])

The Error I get;

AttributeError: module 'pyqtgraph.Qt.QtGui' has no attribute 'QApplication'.

is QApplication no longer supported in pyqtgraph?

Not sure on what to do, I got this source code from github and I don't completely understand what the author was doing.

Edit:

I get a similar error on line 58.

win = pg.GraphicsWindow(title="plotting")
AttributeError: module 'pyqtgraph' has no attribute 'GraphicsWindow'.
2

There are 2 answers

0
AIAI On

I had the same problem, this is how I resolved mine.

from PyQt5 import QtWidgets  
import pyqtgraph as pg
app = QtWidgets.QApplication([])
0
Zhuokai Zhao On

GraphicsWindow has been deprecated, you should replace it with GraphicsLayoutWidget.