<viz:key>.isDown

This command is used to determine if a key is currently down

 

<viz:key>.isDown(
    key    # which key to check
    immediate = False    

)

 

key

This can be either an ascii character or a Vizard special key such as viz.KEY_UP


immediate = False

If True, Vizard will immediately query the keyboard instead of using the cached value.


Remarks

Use this command at any time to see if a key is down.

Return Value

1 if the key is down, 0 if it is not

Example

if viz.key.isDown('a'):
    print '"a" key is down'
if viz.key.isDown(viz.KEY_UP):
    print 'Up Arrow is down'

See also

<viz:key>.allDown
<viz:key>.anyDown
<viz>.callback