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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -