Player = pyglet.media.Player() # our event handling function def on_eos(): print("on player eos") Player.push_handlers(on_eos)