Note that the mainloop (pyglet.app.run()) in the example is critical. 
WIthout it several events from the player are not propagated.

Rob

Op dinsdag 22 september 2015 20:40:02 UTC+2 schreef magu...@gmail.com:
>
> Something like this?
>
> import pyglet
>
> class Example(pyglet.window.Window):
>     def __init__(self):
>         super(Example, self).__init__(640, 480, caption="Example")
>         self.clear()
>
>         self.sound = pyglet.media.load('tone.wav')
>         self.player = pyglet.media.Player()
>         self.player.queue(self.sound)
>         self.player.play()
>
>         pyglet.clock.get_fps()
>         self.fps_display = pyglet.clock.ClockDisplay()
>
>         pyglet.clock.schedule_interval(self.update, .01)
>
>
>     def update(self,dt):
>         if self.player.playing == False:
>             print 'its done playing, do stuff.'
>
>         self.draw()
>
>
>     def draw(self):
>         self.clear()
>         self.fps_display.draw()
>
>         
> if __name__ == '__main__':
>     window = Example()
>     pyglet.app.run()
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pyglet-users+unsubscr...@googlegroups.com.
To post to this group, send email to pyglet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to