I have tried to create a While
loop using the mixer.music.get_busy()
method, which returns True
when the song is playing and False
otherwise I could advance a prompt as soon as the song stops, but in fact the Loop runs Finite times until the end of the song, causing a bug and crashing the system, I already tried to use the mixer.music.queue()
method, which passes a song when the previous one finishes playing, but still generates error. / p>
I'll be dropping down part of the source code, so that you can have a better understanding of what I'm saying.
def escolherDiretorio (self):
diretorio = askdirectory()
os.chdir(diretorio)
for item in os.listdir():
#print(item)
if item.endswith(".mp3"):
real = os.path.realpath(item)
musicas.append(item)
self.musica_atual = mixer.init()
self.musica_atual = mixer.music.load(musicas[0])
self.musica_atual = mixer.music.play()
def play (self):
self.musica_atual = mixer.music.play()
def stop (self):
self.musica_atual = mixer.music.stop()
def nextM (self):
global index
index += 1
self.musica_atual = mixer.music.load(musicas[index])
self.musica_atual = mixer.music.play()
def back (self):
global index
index -= 1
self.musica_atual = mixer.music.load(musicas[index])
self.musica_atual = mixer.music.play()
If you can help me, I'll be grateful.