keys
Key to wait for.
If keys is a sequence, then the Condition will wait for one of the keys to be pressed.
If keys is None, then the Condition will wait for any key to be pressed.
This command will create a Condition object that will wait for one of the specified keys to be pressed.
The yielded command returns a
viz.Data object with the following information about the condition:
key | The key that was pressed |
time | The precise time of the key press |
Example 1:
import viztask
def MyTask():
while True:
yield viztask.waitKeyDown(' ')
print('Spacebar pressed')
viztask.schedule( MyTask() )
Example 2:import viztask
def MyTask():
while True:
yield viztask.waitKeyDown(('a','b','c'))
print('a, b, or c was pressed')
viztask.schedule( MyTask() )
Example 3:import viztask
def MyTask():
while True:
d = yield viztask.waitKeyDown(None)
print("Key '"+d.key+"' was pressed at time",d.time)
viztask.schedule( MyTask() )