[PySide] most basic QThread problem

Frank Rueter | OHUfx frank at ohufx.com
Mon Dec 16 08:01:12 CET 2013

Hi all,

I am playing with simple QThread object and am getting the ol' "QThread: 
Destroyed while thread is still running" error.

I have searched the web quite a bit now and keep running into examples 
that do exactly what I am doing, except it seems to work for others.
Can somebody tell me where I'm going wrong with this bare bones examples 


from PySide import QtCore
import time

class MyThread(QtCore.QThread):

     def __init__(self, parent=None):
         super(MyThread, self).__init__(parent)

     def run(self):
         for i in xrange(10):
             print i

class MainApp(QtCore.QObject):

     def __init__(self, parent=None):
         super(MainApp, self).__init__(parent)
         self.thread = MyThread(self)

     def doIt(self):

if __name__ == '__main__':
     a = MainApp()

More information about the PySide mailing list