<vizact>.onevent

Registers a function to handle the specified event

 

<vizact>.onevent(
    event    
    callback    
    func    
    *args    

)

 

event

The event ID


callback

Callback that will take event arguments and return a 2 item tuple. The first item can be True or False, and specifies whether the vizact event should be triggered. The second item specifies the value to pass to the vizact callback. Use None if no value should be passed.


func

The function to call when the key is pressed


*args

The arguments to pass to the function


Remarks

This command will call the specified function when the specified event is triggered and the specified callback returns True.

Return Value

vizact.EventFunction

Example

def spacebar():
    print 'spacebar pressed'

vizact.onevent(viz.KEYDOWN_EVENT, lambda k: (k==' ',None),spacebar)