I am trying to make a simple GUI for an alarm using Tkinter and the sound plays when the imputed time is reached. However, it should also open a new window with a snooze button on it that when pressed waits five minutes before the sound goes off again. For some reason this new window doesn't open and the rest of the code runs without error and I just can't figure out why. Any help is greatly appreciated.
if str(Time) == str(Alarm):
winsound.PlaySound('Alarm.wav', winsound.SND_FILENAME) #Plays alarm sound
GoingOff = Tk() #Should open new window, why doesn't it open???
GoingOff.geometry('309x225')
GoingOff.title('Wake Up')
label2 = Label(GoingOff, text = '\nSnooze?')
label2.pack()
def Snooze5(): #Code for the snooze function to be called when the button is pressed.
time.sleep(300)
winsound.PlaySound('Alarm.wav', winsound.SND_FILENAME)
Snooze5 = Button(GoingOff,font=("Helvetica", 16), text="Snooze for 5 minutes", width = 16, height = 4, command=Snooze5)
Snooze5.pack()
else:
time.sleep(5)
Aucun commentaire:
Enregistrer un commentaire