I'm trying to use this tutorial to run pygame instead of Mplayer in my script:
So, in the code:
import pygame
pygame.init()
song = pygame.mixer.Sound(my_song.ogg)
clock = pygame.time.Clock()
song.play()
while True:
clock.tick(60)
pygame.quit()
print "done" # not appears
exit()
The song is playing well, but "done" is never printed in the console. The program stays in the loop... How to fix it ? Thanks
Edit: I found this, it's working well, with a 10 second song:
import pygame
import time
pygame.init()
song = pygame.mixer.Sound(son)
clock = pygame.time.Clock()
song.play()
while True:
clock.tick(60)
time.sleep(10)
break
pygame.quit()
print "done"
exit()