I have a similar issue with an application I am putting together. I have a 
minimum working example:

from pyqtgraph.Qt import QtCore, QtGui
from threading import Thread, Event
import time, random
import numpy as np
import pyqtgraph as pg

# Build a simple GraphicaLayout containing an image plot
app = QtGui.QApplication([])
win = pg.GraphicsLayoutWidget()
win.setWindowTitle('Test pyqtgraph paint halt')
win.show()
plot = win.addPlot()
spectrum = plot.plot()
plot.enableAutoRange(pg.ViewBox.XYAxes)

# Routine to acquire and serve data
# This might be a camera driver, notifying when a new frame is available
def generate_data(threadkill):
    while not threadkill.is_set():
        width = 1600
        data = np.zeros(width)
        data += np.cos(np.arange(0, 10*np.pi, 10*np.pi/width) - 
9*time.monotonic())
        data += np.cos(np.arange(0, 4*np.pi, 4*np.pi/width) + 
4*time.monotonic())
        update_data(data)
        # Can sleep for a bit, but doesn't make a difference to whether 
display will stop or not
        # Although perhaps sleep 0.01 seems to make it stop faster?
        time.sleep(0.01)
threadkill = Event()
thread = Thread(target=generate_data, args=(threadkill,))
app.aboutToQuit.connect(lambda event=threadkill: event.set())
thread.start()

def update_data(data):
    spectrum.setData(data)

if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()

My program gets served images/spectra from a (non-Qt python) camera 
interface, which is where the threading routine would live. I would 
subscribe the update_data method to receive callbacks when new data is 
ready. Sometimes it will run for several minutes (as will this example) but 
inevitably the paint events of the plot will stop. The plot menus still 
appear and interaction is still possible, but paint events don't occur 
until forced by a window resize or similar.

It could be my imagination, but running the generate_data with the 0.01 s 
sleep time seems to trigger the issue faster than no sleep.

Is this just that updating the plot data (Qt application) from a different 
(non-Qt) thread is a bad idea?

Not sure if related, as this error message does not occur on the freeze and 
I don't see any error messages in my application, but I noticed a image 
version of the example  above also produced this:
Traceback (most recent call last):
  File 
"/home/patrick/Documents/pyqtgraph-test/pyqtgraph/graphicsItems/ImageItem.py", 
line 420, in paint
    p.drawImage(QtCore.QRectF(0,0,*shape), self.qimage)
TypeError: arguments did not match any overloaded call:
  drawImage(self, QRectF, QImage, QRectF, flags: 
Union[Qt.ImageConversionFlags, Qt.ImageConversionFlag] = Qt.AutoColor): 
argument 2 has unexpected type 'NoneType'
  drawImage(self, QRect, QImage, QRect, flags: 
Union[Qt.ImageConversionFlags, Qt.ImageConversionFlag] = Qt.AutoColor): 
argument 1 has unexpected type 'QRectF'
  drawImage(self, Union[QPointF, QPoint], QImage, QRectF, flags: 
Union[Qt.ImageConversionFlags, Qt.ImageConversionFlag] = Qt.AutoColor): 
argument 1 has unexpected type 'QRectF'
  drawImage(self, QPoint, QImage, QRect, flags: 
Union[Qt.ImageConversionFlags, Qt.ImageConversionFlag] = Qt.AutoColor): 
argument 1 has unexpected type 'QRectF'
  drawImage(self, QRectF, QImage): argument 2 has unexpected type 'NoneType'
  drawImage(self, QRect, QImage): argument 1 has unexpected type 'QRectF'
  drawImage(self, Union[QPointF, QPoint], QImage): argument 1 has 
unexpected type 'QRectF'
  drawImage(self, QPoint, QImage): argument 1 has unexpected type 'QRectF'
  drawImage(self, int, int, QImage, sx: int = 0, sy: int = 0, sw: int = -1, 
sh: int = -1, flags: Union[Qt.ImageConversionFlags, Qt.ImageConversionFlag] 
= Qt.AutoColor): argument 1 has unexpected type 'QRectF'


-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/4fcf6b3f-7ec7-4970-825f-e5a5d93fef8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to