我正在使用Pyqt6制作GUI并想在其中添加图表和其他数据。当我尝试添加图表时,会出现以下错误:
addWidget(self, QWidget): argument 1 has unexpected type 'PlotWidget' addWidget(self, QWidget, int, int, alignment: Qt.AlignmentFlag = Qt.Alignment()): argument 1 has unexpected type 'PlotWidget' addWidget(self, QWidget, int, int, int, int, alignment: Qt.AlignmentFlag = Qt.Alignment()): argument 1 has unexpected type 'PlotWidget'
这是我的代码:
addWidget(self, QWidget): argument 1 has unexpected type 'PlotWidget' addWidget(self, QWidget, int, int, alignment: Qt.AlignmentFlag = Qt.Alignment()): argument 1 has unexpected type 'PlotWidget' addWidget(self, QWidget, int, int, int, int, alignment: Qt.AlignmentFlag = Qt.Alignment()): argument 1 has unexpected type 'PlotWidget'
这是我的代码:
self.plt=pyqtgraph.PlotWidget()
self.plt.plot([1,2,3,4,5],[1,2,3,4,5])
grid.addWidget(self.plt, 6, 1, 3, 3)
self.setLayout(grid) #up I have grid=QGridLayout()
python3 -m pip install pyqtgraph --upgrade
将其升级到最新版本。 - Domarm