keyboard support


I added this line of code to my program


but the Panda3D window doesn’t close on hitting on escape.

Where am I going wrong?

Looks right to me. Are you sure that line of code is getting executed?


have you “import sys” ?
is the class inheriting from DirectObject?
is the class you have this added to really instanciated?
is there no accept function in this class?

you can also use:

import sys
base.accept('escape', sys.exit)

base is inheriting from directobject already, so sometimes this is easier to use.

to check if events are fired from the keyboard use:


( )