You could schedule a function to run your "if(serial.order='stop'):"
code every iteration of the event loop.  See:

http://pyglet.org/doc/programming_guide/the_application_event_loop.html

~ Nathan

On Sat, May 12, 2012 at 3:48 AM, ikaros <[email protected]> wrote:
> Hi,
>
> I'm pretty new to pyglet, and actually to python kind of the same.
>
> I'm developing a small app without GUI that would have to be able to play
> songs and stop them according to some data that comes from a serial device.
>
> The serial interfacing works perfectly, but I can't manage to make pyglet
> work "asynchronic" without a GUI. I have seen that it is easy to do it with
> window events, but since my inputs come from data read by the same python
> programme, I don't know how to do it.
>
> Summing up, I would like the following:
>
> my_player.play(songname)
> [do events]...
> if(serial.order='stop'):
>
> my_player.stop()
>
>
>
> It could be possible with threading, but there should be for sure an easy
> way to do it.
>
> Thanks a lot in advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "pyglet-users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/pyglet-users/-/qmj0pwsFur4J.
> 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.

-- 
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