PyQT Qthread stuck main app

daved170 daved170 at
Tue Sep 15 12:59:35 CEST 2009

Hi everybody,
I've got a simple GUI app written in python and pyqt.
I'm having 2 buttons - "start" and "stop"

start calls a function that start a thread and stop stops it.

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?
Thanks Dave

class myThread(QtCore.QThread):
      self.alive = 1

   def run(self):
      while self.alive:
           print "Alive"
      print "Not Alive"

   def stop(self):
       print "stop pushed"
       self.alive = 0

class GUI(QtGui.QMainWindow):
      def __init__(self):
          .... # all kind of initialization

     def on_start_clicked(self):
         self.cThread = myThread()

     def on_stop_clicked(self):

More information about the Python-list mailing list