pygame.mixer.music.queue(play_next) code example

Example: pygame.mixer.music.queue

import pygame
import time
from tkinter import *

root = Tk()
c = ["music1.mp3","music2.mp3","music3.mp3"] #you_can_add_more
x= 0

def music():
    pygame.init()
    pygame.mixer.init()
    pygame.mixer.music.load(c[x])
    pygame.mixer.music.play(0)
    que()

def que():
    global x, c
    pos = pygame.mixer.music.get_pos()
    if int(pos) == -1:
        x += 1
        pygame.mixer.music.load(c[x])
        pygame.mixer.music.play(0)

    root.after(1, que)

music()

root.mainloop()