PyQT Qthread stuck main app
davea at ieee.org
Tue Sep 15 17:46:13 CEST 2009
> On Sep 15, 2:54 pm, David Boddie <dbod... at trolltech.com> wrote:
>> On Tue Sep 15 12:59:35 CEST 2009, daved170 wrote:
>>> my problem is that when start is pusshed the entire window stuck and
>>> it's impossible to push the STOP button and even when it looks like
>>> it's been pushed it actually don't do anything.
>>> any idea how to fix it?
>> Does adding a call to the base class's __init__() method help?
>> class myThread(QtCore.QThread):
>> self.alive =
> Hi David,
> I did write that line. I forgot copying it to my code here.
> The problem still happens. When I kill the app only then I see the
> message "stopped pushed".
> any other idead?
> thanks Dave
I hesitated to respond, since I don't know/use Qt. But maybe I can help.
I suspect your problem is that the background thread is hogging all the
time. The GIL (Global Interpreter Lock) doesn't handle background
threads well that are CPU bound, especially if you have multiple
processor cores on your system. Try adding a time.sleep(1) after each
print in the background thread. And actually, I suspect that even a
time.sleep(.001) would do it.
More information about the Python-list