This command will create a Condition object that will wait for one of the specified conditions to occur.
The yielded command returns a
viz.Data object with the following information about the condition:
condition | The Condition object which occured |
data | The data returned by the condition object |
Example 1:
import viztask
def MyTask():
while True:
yield viztask.waitAny( [ viztask.waitKeyDown(' '), viztask.waitTime(2) ] )
print('Spacebar pressed or 2 seconds elapsed')
viztask.schedule( MyTask() )
Example 2:import viztask
def MyTask():
waitKey = viztask.waitKeyDown(' ')
waitTime = viztask.waitTime(2)
while True:
d = yield viztask.waitAny( [ waitKey, waitTime ] )
if d.condition is waitKey:
print('Spacebar was pressed')
elif d.condition is waitTime:
print('2 seconds passed')
else:
print('A miracle occurred')
viztask.schedule( MyTask() )