On Mon, Apr 1, 2013 at 4:39 PM, Itzik Hanoch <[email protected]> wrote:

> Hi guys, Im new to pyglet.
>
> (BTW i posted a question earlier, had no idea where it went, cant find it
> now)
>
> I want to be able to do the following:
>
> 1)Constantly play a certain music unless it is stopped somewhere in the
> code.
>
> 2)Ability to play and stop more sounds while playing that background music.
>
> 3)Ability to add another background track in addition to the existing one.
>
> This is what i currently have (very simple):
>
> *def parse(fd):*
>
> *    for line in fd:*
>
> *        for word in line.split():*
>
> *            if(word == "word"):*
>
> *                s1 = pyglet.resource.media("lines.mp3");*
>
> *                s1.play()*
>
> *                s2 = pyglet.resource.media("look.mp3")*
>
> *                s2.play()*
>
> *                pyglet.app.run()    <------------ Cant get pass this line
> *
>
> *
> *
>
> *def filehandle(filename):*
>
> *    while(True):*
>
> *        print "parsing"*
>
> *        fd = open(filename,'r+')*
>
> *        parse(fd)*
>
> *        fd.close()*
>
> *
> *
>
> *if __name__ == '__main__':*
>
> *    print "Please enter file name: ";  *
>
> *    filename = raw_input()*
>
> *    filehandle(filename)*
>
> *
> *
>
> *    sys.exit()*
>
>
> The thing is, i cant get pass the mentioned line until the currently
> playing sounds are not over.
>
> How can this be done?
>
> (Never mind that i adding the same song over and over again in the
> example, i just want to understand how this can be done)
>
> Thanks!
>
> --


Hi, Itzik.  It looks like you are fundamentally misunderstanding the
event-based nature of Pyglet.  I suggest taking some time to read the
Pyglet Programming Guide[1], paying special attention to the "Writing a
pyglet application", "The application event loop", and "The pyglet event
framework" sections.

[1] http://pyglet.org/doc/programming_guide/index.html

~ Nathan

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to