I can make the program play the music, but the whole window is not functional and only works again when the music stops, ie creating a button with def to pause the button only becomes "clickable" when the whole song stop.
from tkinter import *
from pygame import *
from pygame import mixer
jan = Tk()
jan.title("JANELAA")
jan.geometry('400x400')
class Sistema:
def __init__(self, box):
self.frame = Frame(box)
self.frame.pack()
self.menu = Menu(box)
self.menuFile = Menu(self.menu)
self.menuFile.add_command(label="Musicas" , command=self.msc)
self.menuFile.add_command(label="Notepad")
self.menu.add_cascade(label="File", menu=self.menuFile)
self.menuOption = Menu(self.menu)
self.menuOption.add_command(label="Calculadora")
self.menu.add_cascade(label="Options" , menu=self.menuOption)
box.config(menu=self.menu)
def msc(self):
lbl = Label(jan, text="MUSICA COLD BLOODED")
lbl.place(x=50, y=50)
def ok():
mixer.init()
mixer.music.load('coldb.mp3')
mixer.music.play(1 , 1)
while mixer.music.get_busy():
time.Clock().tick(10)
bt = Button(jan, text="TOCAR", command=ok)
bt.place(x=50, y=70)
Sistema(jan)
jan.mainloop()