On Sunday 05 April 2009 21:29:44 Hazen Babcock wrote:
> I'd suggest expanding your MyThread class to something like this:
> class MyThread(QtCore.QThread):
>      def __init__(self, parent = None):
>          QtCore.QThread.__init__(self, parent)
>          self.running = 1
>       def run(self):
>           n = 0
>           step = 1
>           while self.running:
>               n += step
>               print n
>               self.msleep(100)
>      def stop(self):
>        self.running = 0
> You should also look at the QtCore.QMutex() class, which provides a way
> to synchronize (via locking) between the thread process and other
> processes.

Another reason while this will not work as expected is the Big Intepreter 
Lock. Unless QThread releases the BIL in its *sleep-functions, the thread will 
block the execution of the main-thread...

Arnold

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to