I have the following code in python
#*-coding:utf-8;-*
import pygame
pygame.init()
pygame.mixer.music.load('ex1.mp3')
pygame.mixer.music.play()
pygame.event.wait()
In case, it should play a song when it is run in pycharm, however, it performs the function, waits a few seconds and simply terminates the program, without returning any errors, how can I fix this?
When using 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 think that's not the best way to do this with python / pygame