Hi, I'm a complete beginner at threading in any programming language, and I was trying to set up threading with a video stream that I'm displaying in an application I'm building for a research project using PyQt4. The frames are acquired through OpenCV, then converted to a pixmap and displayed in a QGraphicsScene as part of a QGraphicsView. The QGraphicsView also uses the drawForeground function to draw an overlay (a fairly simple grid and some text) on the video stream. The video is a little bit choppy but that's alright for now.

The issue I'm having is that the application needs to interface with an external device connected through the serial port every so often. During this process, the data that is used to update the foreground changes as does the contents of the video stream. What I want to do is have the video stream and the drawForeground function (but primarily the video stream) running continually as this external device performs its procedure (which can take 30 seconds to a couple minutes, as of now.) Right now I've gotten it to update the stream mid-procedure in a kind of hacky way, passing the app object reference down to the class that performs the serial functions and having it call app.processEvents() every time it gets a break in communication. However, this is jumpy and we would like to get a continual stream running independently of the serial communication.

I've read up a little bit about threading and while it seems like it would be able to accomplish what we're trying to do here, I'm having some trouble figuring out where to start and I don't fully understand the concepts. I will be glad to provide specific information about my app, and any tutorials or advice would be greatly appreciated!