I can't figure out how to get a tkinter list box to play continuous audio files in my Music Player without using classes, which I don't fully understand yet since I am new to python. I already created an event by following examples ,that prints the song that played and the next song in the list box but I don't know how to move from there.
SONG_END = pygame.USEREVENT+1
pygame.mixer.music.set_endevent(SONG_END)
def check_event():
for event in pygame.event.get():
if event.type == SONG_END:
print('music end event')
for i in listbox.curselection():
nxt_song = listbox.get(i + 1)
print(nxt_song)
root.after(100, check_event)
def next_s ():
# i cant figure out how to proceed from here to
# get the nxt song and play it
pass
def play():
# activates the play button
current = listbox.get(ACTIVE)
playing_song['text'] = current # goes to a label displaying the current track name
mixer.music.load(current)
mixer.music.play()
# everything works as i want exept continuous play
# note that i dont want the player to have previous and next buttons
check_event
function is happening every .1 seconds is that what you really want? If you have been able toprint
the next song via the binding tonxt_song
then what is stopping you from using that? It's easier to make suggestions when you add your attempt. What did you try inside ofnext_s
that didn't work?