hi
I added this line of code to my program
self.accept(‘escape’,sys.exit)
but the Panda3D window doesn’t close on hitting on escape.
Where am I going wrong?
hi
I added this line of code to my program
self.accept(‘escape’,sys.exit)
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?
David
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:
messenger.toggleVerbose()