0
以下代碼僅用於測試pyqtgraph的速度。我期望的是永遠得到交替圖。但是,在執行此代碼後,小部件中沒有顯示任何內容。問題是什麼?爲什麼pyqtgraph這個簡單的例子不起作用?
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from random import randint, uniform
from math import *
import pyqtgraph as pg
import time
class Example(QWidget):
def __init__(self):
super().__init__()
self.x=pg.PlotWidget(self)
self.x.setMinimumHeight(400)
self.x.setMinimumWidth(400)
self.setWindowState(Qt.WindowMaximized)
self.u=[i+uniform(1,30) for i in range(1000)]
self.v=[-i+uniform(1,30) for i in range(1000)]
self.show()
def Run(self):
while 1:
self.x.clear()
self.x.plot(self.u)
self.x.clear()
self.x.plot(self.v)
app=QApplication(sys.argv)
ex=Example()
ex.Run()
sys.exit(app.exec_())