Ask your own question, for FREE!
Computer Science 13 Online
OpenStudy (anonymous):

i want to update some label text in my program that written with python and pyqt4 i think that i have to use QTread can someone tell me how to use it .

OpenStudy (shadowfiend):

You shouldn't need a QThread to change label text. I'd have to see the specifics of how you've set things up, but usually you should just be able to refer to the label and call setText on it; e.g.: label = QtGui.QLabel(self) label.setText("My text")

OpenStudy (anonymous):

ah sorry i forget to say that i want to update it every 5 sec

OpenStudy (shadowfiend):

Got it. Look into QTimer. You can connect a QTimer's timeout signal to a slot in your class, causing it to fire every X amount of time (5 seconds in your case), and in that slot you can set the label text.

OpenStudy (anonymous):

thanks that exactly what i want .

OpenStudy (shadowfiend):

Sweet!

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!