How do I stop the game, if for example ‘exit’ button is pressed?
yes, and I want to exit the game complitely and close all the windows.
Well, here’s something that stops Panda, at least the method I use, there are better ones out there, I’m sure:
import direct.directbase.DirectStart
import sys
def windDown():
# De-initialization code goes here!
sys.exit()
messenger.accept('s', None, windDown)
run()
Hit the ‘s’ key while this is running and it exits it for you.
Yep, that’s a fine way to stop Panda. We hang a hook on the Python exit function to do any necessary cleanup (like closing windows), so sys.exit() is really all you need to do.
David