本文整理匯總了Python中Scene.Scene.fromFile方法的典型用法代碼示例。如果您正苦於以下問題:Python Scene.fromFile方法的具體用法?Python Scene.fromFile怎麽用?Python Scene.fromFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Scene.Scene
的用法示例。
在下文中一共展示了Scene.fromFile方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Scene
# 需要導入模塊: from Scene import Scene [as 別名]
# 或者: from Scene.Scene import fromFile [as 別名]
#!/usr/bin/python3
import sys, logging, time
from Scene import Scene
logging.basicConfig(level=logging.DEBUG)
s = Scene()
s.fromFile(sys.argv[1])
running = []
times = sorted(s.commands.keys())
t = 0
while t <= s.getDuration():
## Check if we reached a new command ##
if (len(times) > 0) and (t >= times[0]):
for c in s.commands[times[0]]:
print("%10dms: BEG: %s" % (t, c))
running.append((t, c))
times.pop(0)
## Maintain running commands ##
stillRunning = []
for c in running:
res = c[1].maintain(t-c[0])
if res == 0:
stillRunning.append(c)
elif res == 1:
print("%10dms: END: %s" % (t, c[1]))
elif res == 2:
stillRunning.append(c)
print("%10dms: RST: %s" % (t, c[1]))
t -= 1
else:
raise ValueError()