[PyQt] update qt labels from another thread

Pradnyesh Sawant spradml at gmail.com
Wed Apr 11 13:13:33 BST 2007


Hello,
I have a Qt4 form, which contains some labels, and 2 buttons "start"
and "stop". The start button, when clicked, creates an instance of a
python class which does some communication over sockets in another
independent thread of its own. The stop button kills the instance
created above, and kills the thread.
What i want to do is to update the text of my form labels with the
data that i receive over the socket communication. For this reason, i
sent the "form" object to the backend class object, and tried updating
the form labels from within the thread doing the socket communication.
However, i get an error saying that Qt objects cannot be modified from
other threads :(

How do i achieve updates of form labels? In a previous mail on this
list itself, i read something about signals/slots/callbacks. I don't
see how signals/slots will be helpful here (however, plz note that i
am relatively new to PyQt4 and this might be incomplete knowledge on
my part). As far as callbacks are concerned, i don't know what they
mean. Any pointers/tutorials for me would be greatly helpful...

Thanks a lot in advance!
--
warm regards,
Pradnyesh Sawant
--
Be yourself......everyone else is taken. --Anon


More information about the PyQt mailing list