<viz>.callback

This command registers a callback function. This is required to handle events

 

<viz>.callback(
    event    
    function    

)

 

event

Specifies the type of event


function

Specifies the function to be called (i.e., function pointer). If the value is 0, then the callback will be disabled.


Remarks

Use this command to register a function to handle a particular type of event. When the registered type of event occurs during the simulation cycle, Vizard will call the desired function with certain state parameters depending on the type of event.

This command will register the callback with the global event class. This means only one function can be registered per event. If you want to register multiple functions per event then you need to create your own event class to handle the event.

Return Value

None

Example

# Your function definition here
def HandleKeyboard(key):
     print key
viz.callback(viz.KEYDOWN_EVENT, HandleKeyboard)

See also

<viz>.starttimer
<viz>.killtimer
<viz>.starthotspot