Reputation: 413
A friend asked me to create and compile to exe this for him to stick in the start up folder of his dads computer. Why oh why wont pygame play the sounds? It just crashes my python on both my laptop and desktop : import easygui as eg import pygame pygame.init pygame.mixer.init()
def sound():
pygame.mixer.init()
pygame.mixer.music.load('scream.mp3')
pygame.mixer.music.play(0)
def prg():
img="scary.gif"
choices=["Turn Off Scream","Turn scream off"]
msg="LAUGHING QUITE LOUDLY"
title="LQLLQLLQLLQLLQLLQLLQLLQL"
reply=eg.buttonbox(msg,title,image=img,choices=choices)
if reply=="Turn Off Scream":
lql()
elif reply=="Turn scream off":
lql()
def lql():
prg()
while 1:
sound()
prg()
Upvotes: 0
Views: 451
Reputation: 3752
The pygame docs note:
Be aware that mp3 is limited. On some systems an unsupported format can crash the program. ... Consider using OGG instead.
http://www.pygame.org/docs/ref/music.html
Since the sound is probably short, wav may be a safe choice too.
Upvotes: 1