Как сделать постоянную проверку условия в Python?
Мне нужно сделать так, что бы в напоминалке постоянно сравнивалось введённое время и текущее время. Как это реализовать? (что поставить вместо while? Программа зависает и звук никогда не начнет проигрываться)
Вот код:
from tkinter import *
from tkinter import messagebox
from time import gmtime, strftime
from playsound import playsound
def show_message():
messagebox.showinfo("Вывод", 'Напоминалка создана')
entrytime = message.get()
nowtime = strftime("%H:%M")
while(True):
if(nowtime == entrytime):
playsound('file.mp3')
root = Tk()
root.title("Напоминалка")
root.geometry("300x250")
message = StringVar()
txt1 = Entry(textvariable=message)
txt1.place(relx=.5, rely=.1, anchor="c")
txt2 = Entry(textvariable=message)
txt2.place(relx=.5, rely=.1, anchor="c")
message_button = Button(text="Создать", command=show_message)
message_button.place(relx=.5, rely=.5, anchor="c")
root.mainloop()