PyQt and Threading to update a dialog?

Phil Thompson phil at riverbankcomputing.co.uk
Mon Feb 20 17:54:05 EST 2006


On Monday 20 February 2006 10:07 pm, Fabian Steiner wrote:
> 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



More information about the Python-list mailing list