Skip to content

Instantly share code, notes, and snippets.

@hortonew
Created January 11, 2013 00:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hortonew/4507036 to your computer and use it in GitHub Desktop.
Save hortonew/4507036 to your computer and use it in GitHub Desktop.
Pyglet - Handle Events
import pyglet
from pyglet.window import key
screen = pyglet.window.Window(800,600)
@screen.event
def on_key_press(symbol, modifiers):
if symbol == key.A:
print 'You pressed A'
def update(dt):
#update objects here
if __name__ == "__main__":
pyglet.clock.schedule_interval(update, 1/120.0)
pyglet.app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment