There are two ways to add event callbacksm using either addEventCallback()
. Either one is fine. Just a note: if you want to ever remove the event callback you've added, you need to save the object reference these functions return and use that (instead of the original callback function itself). This has to do with the way it's implemented in pivy.
The issue in your particular case appears to be testing for the event type. addEventCallback()
returns everything in a nice Python dictionary, whereas addEventCallbackPivy()
returns what you'd get if you were using coin3d directly in C++.
Code: Select all
def my_keyboard_callback(self, so_event_cb):
Note your callback must be part of a class object. Static methods (with no self parameter), so far as I know, will not work.
Refer to the https://grey.colorado.edu/coin3d/classS ... Event.html
for more information on what to do with the event returned by getEvent()
, if you haven't already.