Re: PyQT Qthread stuck main app

Discussion in 'Python' started by David Boddie, Sep 15, 2009.

  1. David Boddie

    David Boddie Guest

    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
     
    David Boddie, Sep 15, 2009
    #1
    1. Advertising

  2. David Boddie

    daved170 Guest

    On Sep 15, 2:54 pm, David Boddie <> 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
     
    daved170, Sep 15, 2009
    #2
    1. Advertising

  3. David Boddie

    Dave Angel Guest

    daved170 wrote:
    > On Sep 15, 2:54 pm, David Boddie <> 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
     
    Dave Angel, Sep 15, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    347
  2. Pradnyesh Sawant

    problem with qthread and signal/slot

    Pradnyesh Sawant, Apr 14, 2007, in forum: Python
    Replies:
    0
    Views:
    481
    Pradnyesh Sawant
    Apr 14, 2007
  3. daved170

    PyQT Qthread stuck main app

    daved170, Sep 15, 2009, in forum: Python
    Replies:
    0
    Views:
    444
    daved170
    Sep 15, 2009
  4. someone
    Replies:
    0
    Views:
    688
    someone
    Nov 21, 2009
  5. Jonathan Lee

    Re: Pass View object to QThread

    Jonathan Lee, Jan 3, 2010, in forum: C++
    Replies:
    3
    Views:
    964
    Rui Maciel
    Jan 3, 2010
Loading...

Share This Page