Forum: Poser Python Scripting


Subject: A multithreading in Poser Python.

JTrout opened this issue on Nov 02, 2011 · 9 posts


JTrout posted Wed, 02 November 2011 at 11:33 AM

Hi

I can't implement multithreading code in PoserPython.
For example, Poser freezes when it runs the following simple script.

#----------------
import time
import threading

class MyThread(threading.Thread):
    def init(self):
        threading.Thread.init(self)
        self.setDaemon(True)
        
    def run(self):
        print "Start1n"
        for i in range(10):
            print 'Thread1: %in' % i
            time.sleep(2)
        print "Completed1n"

def main():
    thread = MyThread()
    thread.start()
    
    print "Start0n"
    for i in range(10):
        print 'Thread0: %in' % i
        time.sleep(2)
    print "Completed0n"
    
main()
#----------------

Of course, that works properly outside Poser as expected.
I tried with PoserPro2010.  

Please tell me, if there is a solution.

Thank you