[PyQt] GUI thread check

David Boddie david at boddie.org.uk
Fri Jan 16 23:54:32 GMT 2009


On Fri Jan 16 22:58:03 GMT 2009, Frédéric wrote:
> On vendredi 16 janvier 2009, Zac Burns wrote:
>
> > Can I check to see if the current thread is the safe 'main' GUI thread?
>
> Yes, using
>
>     threading.currentThread().getName()
>
> The main thread is called 'MainThread'.

It may be called that now, but is it always guaranteed to have that name?

An alternative might be to compare the current thread with the application's
thread, perhaps obtained using qApp.thread().

David



More information about the PyQt mailing list