I'm trying to update a pyqtgraph plot in a loop. The problem is, that the plot window remains white. I suppose that this is because of the time.sleep() I also use in the loop and the program doesn't have the time to paint the plot. Is there a possibility to use the pyqt function processEvents() in order to solve this issue? Unforunately pyqtgraph.GraphicsWindow is unaware of this function ;)
Unfortunately, you're right about bad performance with this solution.
I'm now working on the repaint method. It is absolutely no problem that only a single widget is redrawn, that is everything I need. Bad news: I'm creating a plot with the following code (this works perfectly):
window=pyqtgraph.GraphicsWindow(...)
plot1=self.window.addPlot(0, 0)
...
plot1.plot(data1, data2)
But the following lines only end in a white window:
while True:
time.sleep(5)
...
window.repaint()
I'm not plotting that many points (<70) about every second. The style options are more or less the default ones. I don't expect any performance problems there. The symptom is mainly the lack of reaction when dragging and resizing windows for several seconds. It isn't nescessary for the actual purpose of the program but suboptimal during presentations. Maybe I should try a better notebook. ;)
I've attached a very shortened version of my project which uses random numbers instead of about a hundred lines of code ;)
while the application runs quite smooth when left alone there still are lags when dragging and resizing the window. (only tested on one computer, I have to admit)
timer = Qt.QTimer()timer.timeout.connect(update)timer.start(1000)Qt.QApplication.exec_()
hey, you're right, this certainy works much smoother than my attempt :)
This is absolutely sufficient.
Can I place pyqtgraph-windows with absolute coordinates on screen? Then I wouldn't have to move the window at all. QtGui.QWidget knows a method move()...