There seems to be a problem with your current code. The
while loop inside your
game task is not yielding. This will probably cause the graphics loop to freeze. It seems like there should be a
yield None statement at the end of the loop.
Regarding your original question. You can setup a simple callback function that restarts the
game task when the 'r' key is pressed. Example:
Code:
def ResetGame():
global myTask
myTask.kill() # Kill existing task
myTask = viztask.schedule( game() ) # Create new game task
vizact.onkeydown('r',ResetGame)