Vizard 8 » Command Index » Vizard modules » vizact » <vizact>.waitkey
8.0

<vizact>.waitkey

Create an action that will wait for the given key to be pressed

<vizact>.waitkey(  
key  
)  
key
The key to wait for. This can be a single key or a list of keys. If it is a list of keys, then the action will wait until one of the keys in the list is pressed.

Remarks

After you have created the action you can add it to any object as many times as you want.

Return Value

An action that can be applied to any <node3d> object

Example

#Create an action that will wait for the spacebar to be pressed
WaitForSpace = vizact.waitkey(' ')

#Create an action to toggle the visibility of an object
ToggleVisible = vizact.method.visible(viz.TOGGLE)

#Create a sequence action that will repeat forever
ToggleSequence = vizact.sequence(WaitForSpace,ToggleVisible,viz.FOREVER)

#Whenever the spacebar is pressed the visiblity of the object will be toggled
object.add(ToggleSequence)

See also

<vizact>.waittime
<vizact>.sequence