Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: PyQT Qthread stuck main app

Reply
Thread Tools

Re: PyQT Qthread stuck main app

 
 
David Boddie
Guest
Posts: n/a
 
      09-15-2009
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
 
Reply With Quote
 
 
 
 
daved170
Guest
Posts: n/a
 
      09-15-2009
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 = 1
>
> 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
 
Reply With Quote
 
 
 
 
Dave Angel
Guest
Posts: n/a
 
      09-15-2009
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I print to text browser with Qthread? (in PyQt) someone Python 0 11-21-2009 12:44 PM
PyQT Qthread stuck main app daved170 Python 0 09-15-2009 10:59 AM
problem with qthread and signal/slot Pradnyesh Sawant Python 0 04-14-2007 10:38 AM
[PY GUI] interest function in python GUI(wxpython,pyqt) program.wxpython,pyqt ulysses Python 4 10-22-2003 03:28 PM



Advertisments