[PyKDE] Keeping the GUI from freezing

Andreas Pakulat apaku at gmx.de
Mon Feb 19 20:35:40 GMT 2007

On 19.02.07 12:12:38, Tony Cappellini wrote:
> Message: 2
> Date: Mon, 19 Feb 2007 17:27:23 +0100
> From: Andreas Pakulat <apaku at gmx.de>
> Subject: Re: [PyKDE] Keeping the GUI from freezing
> To: pykde at mats.imk.fraunhofer.de
> Message-ID: <20070219162723.GC20122 at morpheus.apaku.dnsalias.org>
> Content-Type: text/plain; charset=us-ascii
> >>The "safest" way to do heavy work, without blocking the Ui is a separate
> >>thread.  And unless you have to access main-thread-data from the
> >>worker-thread (or vice versa) this is a relative no-brainer using only
> >>events that are sent to the main thread.
> The script my gui is calling has a fairly intensive while loop which runs
> for approx 20 seconds, depending on how many files it is processing.
> With this in mind, will I still be able to refresh the GUI and keep it
> >from hanging
> if I use your suggestion about threads?

If you run an external script using QProcess and listening for the finished
signal is easier than using a separate thread. 

Apart from that: If you use worker-threads and don't actively wait for
them to finish your gui will automatically update because the Qt event
loop will keep running


You are a very redundant person, that's what kind of person you are.

More information about the PyQt mailing list