[PyQt] GUI freezing when running large function in QThread

Brent Villalobos Brent.Villalobos at pdi.dreamworks.com
Tue Jul 21 17:34:38 BST 2009


Thanks.  I had a feeling that python's GIL (global interpreter lock) 
would be a limiting factor.  I worked around my performance issue by 
doing some smarting caching to avoid some of the more intensive 
operations.  But for the sake of argument, suppose I couldn't rework my 
algorithms.  From what I can gather, is the common consensus that I need 
to spin off new processes?

Jason H wrote:
> This sounds like the GIL.
> Separate the validation to another process, not another thread. Use non-blocking io (Qt's default) do get yoru GUI responsive again.
>
>  
>
>
>
> ----- Original Message ----
> From: Brent Villalobos <Brent.Villalobos at pdi.dreamworks.com>
> To: "pyqt at riverbankcomputing.com" <pyqt at riverbankcomputing.com>
> Sent: Monday, July 20, 2009 7:35:56 PM
> Subject: [PyQt] GUI freezing when running large function in QThread
>
> I'm trying to write a "validation" thread that will run persistently throughout my PyQt program and validate that user has entered the correct values in the fields.  The validation thread calls a function in a separate python module that shouldn't know anything about PyQt since it is a general-purpose module that runs in both gui and non-gui applications.  The problem is that my GUI slows way down where actions like mouse clicks aren't recognized until the validation function finishes.  The validation function is doing some mild CPU and I/O work, but nothing that peaks out the processor or disk.  Unfortunately I don't have a simple case to show at this time, but perhaps people have run into a similar issue in past.  Anyone have any suggestions how I can make a function that runs in a QThread more "gui-friendly" without adding any Qt-specific calls to it?  Thanks.
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
>
>
>       
>   


More information about the PyQt mailing list