PyQt and Threading to update a dialog?

F

Fabian Steiner

Hello!

I have just written a MyDialog class which is derived from the orginial
QDialog class. MyDialog only possesses a QLabel and a QPushButton. Now I
would like to get the QLabel updated every second so that it displays
the current time.
I think I will have to work with Threads in order to achieve this aim,
but so far I didn't succeed in doing it because I couldn't find any
examples.

Could anyone give me some hints or a piece of code?

Cheers,
Fabian Steiner
 
P

Phil Thompson

Hello!

I have just written a MyDialog class which is derived from the orginial
QDialog class. MyDialog only possesses a QLabel and a QPushButton. Now I
would like to get the QLabel updated every second so that it displays
the current time.
I think I will have to work with Threads in order to achieve this aim,
but so far I didn't succeed in doing it because I couldn't find any
examples.

Could anyone give me some hints or a piece of code?

So long as you have the event loop running it's probably easiest to use a
QTimer that connects to a slot in your QDialog sub-class.

No need to use threads.

Phil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top