1
I have the following python code
#*-coding:utf-8;-*
import pygame
pygame.init()
pygame.mixer.music.load('ex1.mp3')
pygame.mixer.music.play()
pygame.event.wait()
In this case, it should play a song while running on pycharm, however, it performs the function, waits a few seconds and simply terminates the program, without returning any errors, how can I fix this?
By using it this way
#*-coding:utf-8;-*
from pygame import mixer
mixer.init()
mixer.music.load('ex1.mp3')
mixer.music.play()
import time
time.sleep(360)
The code ran normally, but I don’t think it’s the best way to do it with python/pygame
still doesn’t seem like a good alternative
– Murilo Melo
worked what I proposed?
– Victor Antonio
works, but it makes me unable to perform anything else with the music, and also, I don’t think it’s a good method, so I didn’t respond
– Murilo Melo