|
楼主 |
发表于 2023-3-26 23:18:12
|
显示全部楼层
- import sys
- import time
- import threading
- #import requests
- def processFunc(runCallback=None):
- curr = time.time()
- while True:
- elapsed = abs(time.time() - curr)
- if elapsed%0.5 < 0.001:
- if runCallback:
- runCallback(elapsed)
- if elapsed > 3:
- break
- def gan(t):
- sys.stdout.write("PyThread: %s \n" % t)
- cmds.move( 1, 1, 1, 'nurbsSphere1', rx=True )
- print(t)
- def porcessPyThread(blocking=False):
- thread = threading.Thread(target=processFunc,kwargs={"runCallback":lambda t:gan(t) })
- thread.start()
- if blocking:
- thread.join()
- porcessPyThread()
- print("done")
复制代码 |
|