python 2.7 - pyglet - Why does the player not return to the command line? -
i implemented basic script play song using pyglet. however, error , control not return command line , have ctrl+c out of it. might happening here?
my code :
import pyglet song = pyglet.resource.media('g.wav', streaming = false) song.play() pyglet.app.run() pyglet.app.exit()
i following :
al lib: pulseaudio.c:331: pulseaudio returned minreq > tlength/2; expect break opengl warning: failed connect host. make sure 3d acceleration enabled vm.
and control not return.
however, when add :
win = pyglet.window.window()
then window can close , playback stops.
can tell me how can implement piece of code here plays file when run , after playing, returns command command line?
you can use code play sound , go command line.
import pyglet music = pyglet.resource.media('sound.wav') music.play() def exit_callback(dt): pyglet.app.exit() pyglet.clock.schedule_once(exit_callback , music.duration) pyglet.app.run()
for more information how works can read other question: pyglet sound playing on python
Comments
Post a Comment