[PySide] most basic QThread problem
Sebastian Elsner
sebastian at risefx.com
Mon Dec 16 09:02:42 CET 2013
Hi,
according to the latest 4.8.4 documentation the subclass approach is
wrong: http://qt-project.org/doc/qt-4.8/qthread.html
For an in-depth explanation see:
http://mayaposch.wordpress.com/2011/11/01/how-to-really-truly-use-qthreads-the-full-explanation/
It's all C++ but the second link is very readable easy to understand.
Cheers
Sebastian
Am 16.12.2013 08:01, schrieb Frank Rueter | OHUfx:
> 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
> please?
>
> Cheers,
> frank
>
> 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
> time.sleep(1)
>
> class MainApp(QtCore.QObject):
>
> def __init__(self, parent=None):
> super(MainApp, self).__init__(parent)
> self.thread = MyThread(self)
>
> def doIt(self):
> self.thread.start()
>
> if __name__ == '__main__':
> a = MainApp()
> a.doIt()
>
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside
More information about the PySide
mailing list