My code for an alarm in tkinter won't open on double click. It runs in idle just fine and all my other tkinter programs open on double click too. What in the code is causing this?
from tkinter import *
import datetime
import time
from time import strftime
import winsound
master = Tk()
master.geometry('300x300')
master.title('Alarm Time')
label = Label(master, text = 'What time would you like to wake up?')
label.pack()
EnteredAlarm = Entry(master)
EnteredAlarm.pack(ipady=8)
def callback():
Alarm = EnteredAlarm.get()
while True:
Time = strftime('%H:%M')
if str(Time) == str(Alarm):
print('Wake up Mister West')
winsound.PlaySound('Alarm.wav', winsound.SND_FILENAME)
break
else:
print('Zzz...')
time.sleep(5)
b = Button(master, text="OK", command=callback)
b.pack()
The code doesn't return any errors, all that happens is cmd opens for half a second then closes. Any help is appreciated, thanks in advance.
master.mainloop()right?