Whenever you register a function with vizact.onkeydown a reference is made in memory between the keystroke and the function. What you wish to achieve is to break that reference. A way to do that, have your program memorize that reference as a variable and then do some operation on that variable, in this case: removeEvent.
Take for example:
Code:
def initialiseProgram():
playJokeEvent = vizact.onkeydown(' ', play_first_joke)
... other initialisation
def play_first_joke():
vizact.removeEvent(playJokeEvent)
.. do your fancy scene stuff here
I have to admit that I am used to program OOP in classes, and the handling of variables is different when using classes in python than when using direct code (self, vs, global). Try this code snippet first, if it doesn't work out well then we might to do some hacking with the [global] statement.