Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Pyglet - Play Single Sound
import pyglet
from pyglet.window import key
#Put sound files in a folder called "resources"
pyglet.resource.path = ['resources']
#Create sound object for laser
screen = pyglet.window.Window(800,600)
laser ='laser.wav')
def on_key_press(symbol, modifiers):
if symbol == key.SPACE:
def update(dt):
#update objects here
if __name__ == "__main__":
pyglet.clock.schedule_interval(update, 1/120.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment