PyQT Update QLabel Threading/Signals Issue
-
I am trying to update a QPixMap QLabel image on each successful iteration in my video function however the threading doesn't work
What I see happening is it sends the entire loop before the signal sends its data back. I am confused why it's doing this
The code in Question I posted below
[code]
def video(self):cam = Device() cam.setResolution(640, 480) a = datetime.datetime.now().strftime("%Y%m%dT%H%M%S%ms") b = str(a) for i in xrange(5): try: snapshot = os.getcwd() + '\\camImages\\' + '%s.png' % (b) cam.saveSnapshot(snapshot) self.client(chr(CMD_VIDEO), snapshot) print "sent" continue except: print "missed image" continue def viewVideo(self, msg): print "received" self.myVideo.setPixmap(QPixmap(msg)) self.myVideo.repaint()
[/code]
Let me explain: In my main GUI class I have it threaded I use this to initiate a signal
[code]
self.thread.mySignal5.connect(self.viewVideo)
[/code]
Then I have those functions I posted earlier (see above). In my Worker/Threading class I initiate mySignal5 like this
[code]
mySignal5 = pyqtSignal('PyQt_PyObject')
[/code]
Then in my run function where I run my server, I have:
[code]
elif cmd == CMD_VIDEO: self.mySignal5.emit(msg) #print msg
[/code]
*cheers if anyone can help
The full code is posted here