【发布时间】:2017-11-25 06:57:06
【问题描述】:
以下代码仅用于测试 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_())
【问题讨论】:
标签: python multithreading pyqt pyqtgraph