I'm trying to make a music interface using tkinter
and winsound
, but when I press the button to play the song I can't click anything in the interface again until the song has finished playing. I'd like to be able to play and pause every song using the tkinter buttons (when I eventually add more songs).
import winsound
from tkinter import *
root = Tk()
def r_n_c():
winsound.PlaySound("abcde.wav", winsound.SND_FILENAME)
def stop():
winsound.PlaySound(None, winsound.SND_ASYNC)
rnc = Button(root, text = "Play Song", command = r_n_c)
rnc.grid()
stop_btn = Button(root, text = "Stop", command = stop)
stop_btn.grid(row = 1)
root.mainloop()
Just add
winsound.SND_ASYNC
inr_n_c()