AttributeError: 模块 ‘pyqtgraph.Qt.QtGui’ 没有 ‘QApplication’ 属性。

huangapple go评论88阅读模式
英文:

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

问题

有关我的系统的详细信息;

Ubunttu 22.04.2 LTS x86_64

pyqtgraph v0.13.1

pyhton v3.10

我试图在第56行运行的代码;

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

我收到的错误;

    AttributeError: 模块 'pyqtgraph.Qt.QtGui' 没有 'QApplication' 属性。

pyqtgraph中不再支持QApplication了吗?

不确定该怎么办,我从GitHub获取了这个源代码,我并不完全理解作者当时在做什么。

编辑:

我在第58行也收到类似的错误。

    win = pg.GraphicsWindow(title="plotting")
    AttributeError: 模块 'pyqtgraph' 没有 'GraphicsWindow' 属性。
英文:

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'.

答案1

得分: 1

我遇到了同样的问题,这是我解决的方法。

英文:

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

from PyQt5 import QtWidgets  
import pyqtgraph as pg
app = QtWidgets.QApplication([])

答案2

得分: 0

GraphicsWindow 已被弃用,您应该将其替换为 GraphicsLayoutWidget

英文:

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

huangapple
  • 本文由 发表于 2023年2月19日 07:38:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/75497080.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定