In PandaFramework:
void define_key (const string &event_name, const string &description, EventHandler::EventCallbackFunction *function, void *data);
So, you have to:
PandaFramework framework;
void exit_event ( const Event *e, void *data )
{
framework->close_all_windows();
}
In your setup section (before looping):
window->enable_keyboard();
framework.define_key ("escape", "Quit", exit_event, (void *) NULL);
This will halt by-the-hard-way your game, it’s recomendable that loop yourself the PandaFramework, so you can stop it when you want.