pygame mixer music queue

Solutions on MaxInterview for pygame mixer music queue by the best coders in the world

showing results for - "pygame mixer music queue"
Lucia
13 May 2017
1import pygame
2import time
3from tkinter import *
4
5root = Tk()
6c = ["music1.mp3","music2.mp3","music3.mp3"] #you_can_add_more
7x= 0
8
9def music():
10    pygame.init()
11    pygame.mixer.init()
12    pygame.mixer.music.load(c[x])
13    pygame.mixer.music.play(0)
14    que()
15
16def que():
17    global x, c
18    pos = pygame.mixer.music.get_pos()
19    if int(pos) == -1:
20        x += 1
21        pygame.mixer.music.load(c[x])
22        pygame.mixer.music.play(0)
23
24    root.after(1, que)
25
26music()
27
28root.mainloop()