[PyKDE] Updating PyQt widgets question

Gordon Tyler gordon at doxxx.net
Wed Nov 19 17:44:01 GMT 2003


Eric Williams wrote:

> I've re-written my app so that it uses a QTimer and timerEvent method to 
> update the widgets, and that the long-running routine (actually an FTP 
> download) runs in a thread; that works like I expected. I guess my question 
> is, is using a QTimer the 'correct' way to update widgets during an expensive 
> routine like the one above? And what sort of widgets can be reliably updated 
> from within a function?

QTimer is one way to go. You could also post custom events from your 
long-running thread to the GUI thread and have your widgets process 
those events to update their state.

Be sure to read this: http://doc.trolltech.com/3.2/threads.html, 
especially the part about Thread-safe Event Posting.

Ciao,
Gordon





More information about the PyQt mailing list