Search code examples
pyglet

Pyglet, how to make the ESCAPE key not close the window?


I am writing a small sample program and I would like to override the default pyglet's behavioyr of ESC closing the app. I have something to the extent of:

window = pyglet.window.Window()
@window.event
def on_key_press(symbol, modifiers):
    if symbol == pyglet.window.key.ESCAPE:
        pass

but that does not seem to work.


Solution

  • On the Google group for pyglet-users it is suggest could overload the window.Window.on_key_press(), although there are no code example of it.