Crashing in QRunner threads with numpy

Heads up! You've already completed this tutorial.

Elliot_Young | 2020-05-11 06:42:47 UTC | #1

Thanks for the great write-up. I'm attempting to use this example to stream a live video feed (numpy array -> QImage -> QPixmap -> QLabel inside a QScrollArea) but I am frequently encountering crashes when the label is resized too quickly, or the scroll area is scrolled too quickly. I have seen people mention that it could be a problem with QImage memory buffer getting cleared before the QPixmap can update the QPainter event, but I tried storing a .copy() of the QImage and that didn't work.

Is this something you think can be fixed, or does it sound like a fundamental issue with the way threads work with Python/PyQt5?


Elliot_Young | 2020-05-11 06:44:24 UTC | #2

Well only about 30 minutes later, I was able to implement a new signal (bool, 'result' signal) that gets emitted when the QImage is converted. I also moved the setPixmap event to a separate function that only runs when the 'result' signal is emitted and now I haven't experienced any crashes. Thanks so much for your tutorials - I just bought the book!


Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak

Crashing in QRunner threads with numpy was written by Martin Fitzpatrick .

Martin Fitzpatrick has been developing Python/Qt apps for 8 years. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. Starting with Tk, later moving to wxWidgets and finally adopting PyQt.