I want to have the block turn green and the sound play together, or if that's not possible then I would like to have the block turn green first. but I can't find out why the sound is playing first... Here is my code:
def number(*args):
try:
x = r.get()
if x <= '3':
s.configure('Danger.TFrame', background='green',
borderwidth=5, relief='raised')
ttk.Frame(root, width=200, height=200, style='Danger.TFrame')
winsound.PlaySound('dotto.wav', winsound.SND_FILENAME)
print("green")
elif x >= "5":
s.configure('Danger.TFrame', background='red',
borderwidth=5, relief='raised')
ttk.Frame(root, width=200, height=200, style='Danger.TFrame')
print("red")
else:
s.configure('Danger.TFrame', background='orange',
borderwidth=5, relief='raised')
ttk.Frame(root, width=200, height=200, style='Danger.TFrame')
print("orange")
except:
print("error")
I am using winsound, and the file thats playing is dotto.wav.
Thanks,