On Thu, Jun 19, 2008 at 4:31 AM, Richard Thomas <[EMAIL PROTECTED]> wrote:
>
> You aren't dispatching events for the player. If you call the play
> method of a source you get a
> managed sound player which will be handled by
> pyglet.media.dispatch_events, normal players don't do this (in 1.0,
> 1.1 is changing things a little). At any rate, try this:
>
> ...
> @w.event
> def on_key_press(a, b):
>  player = disconnect_sound.play()
>  player.push_handler(on_eos=some_function)

That code gives me this error:

Traceback (most recent call last):
  File 
"/private/var/tmp/python/python-30~44/python/Modules/_ctypes/callbacks.c",
line 206, in 'calling callback function'
  File "/Library/Python/2.5/site-packages/pyglet/window/carbon/__init__.py",
line 985, in _on_key_down
    self.dispatch_event('on_key_press', symbol, modifiers)
  File "/Library/Python/2.5/site-packages/pyglet/window/__init__.py",
line 1216, in dispatch_event
    EventDispatcher.dispatch_event(self, *args)
  File "/Library/Python/2.5/site-packages/pyglet/event.py", line 340,
in dispatch_event
    if handler(*args):
  File "test.py", line 18, in on_key_press
    player.push_handler(on_eos=some_function)
AttributeError: 'ManagedSoundPlayer' object has no attribute 'push_handler'

This code:

   player = disconnect_sound.play()
   player.push_handlers(on_eos=some_function)

AND this code:

   player = disconnect_sound.play()
   player.set_handler('on_eos', some_function)

both don't ever call some_function.  Just like my original code
doesn't call some_function.

What are we missing?

~ Nathan

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to