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

<vizact>.addCallback

Register a generic callback function

<vizact>.addCallback(  
event  
func  
priority = 0  
)  
event
The event ID
func
The function to call when the event is triggered.
priority = 0
The priority to register the callback function with.

Remarks

This command will registers a generic callback function for the specified event ID. The function will be passed the original event arguments.

Return Value

A vizact.EventFunction object with the following methods:

Method

Description

<event>.setEnabled(val)

Enable/Disable the event function. The associated function will not be called while the event function is disabled. viz.TOGGLE can be used to toggle the state. Event functions are initially enabled.

<event>.getEnabled()

Get the enabled state of the event function.

<event>.remove()

Permanently unregister the event function.

Example

def onKeyDown(key):
    print('key down',key)

vizact.addCallback(viz.KEYDOWN_EVENT,onKeyDown)

See also

<vizact>.onevent
<vizact>.removeEvent