Re: PyQT Qthread stuck main app

2009-09-15 Thread David Boddie
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):
   def__init__(self):
  QtCore.QThread.__init__(self)
  self.alive = 1

David
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyQT Qthread stuck main app

2009-09-15 Thread Dave Angel

daved170 wrote:

On Sep 15, 2:54 pm, David Boddie dbod...@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):
   def__init__(self):
  QtCore.QThread.__init__(self)
  self.alive =

David



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.


DaveA

--
http://mail.python.org/mailman/listinfo/python-list