Alarme para tomar medicamentos (usando Tkinter)
from tkinter import *
import datetime
import time
from tkinter import messagebox
def med(set_alarm_timer):
while True:
time.sleep(1)
actual_time = datetime.datetime.now()
cur_time = actual_time.strftime("%H:%M:%S")
cur_date = actual_time.strftime("%d/%m/%Y")
if cur_time == set_alarm_timer:
messagebox.showinfo("Atenção",
"Hora de tomar medicamentos")
break
def tomar_medacamentos():
hora_tomar = f"{hora.get()}:{min.get()}:{sec.get()}"
med(hora_tomar)
window = Tk()
window.title("Tomar Medicamentos")
window.geometry("400x160")
window.config(bg="#922B21")
window.resizable(False,False)
addTime = Label(window, text=" H Min "
"Sec", font=60, fg="white", bg="black").place(x=210)
setYourAlarm = Label(window, text="Hora do Medicamentos: ",
fg="white", bg="#922B21", relief="solid",
font=("Helevetica", 13, "bold")).place(x=10, y=40)
hora = StringVar()
min = StringVar()
sec = StringVar()
qhora = Entry(window,textvariable=hora, bg="#48C9B0", width=4,
font=(20)).place(x=210, y=40)
qmin = Entry(window, textvariable=min, bg="#48C9B0", width=4,
font=(20)).place(x=270, y=40)
qsec = Entry(window, textvariable=sec, bg="#48C9B0", width=4,
font=(20)).place(x=330, y=40)
butao = Button(window, text="Hora do Medicamento", fg="Black",
bg="#D4AC0D", width=20, command=tomar_medacamentos,
font=(20)).place(x=100, y=90)
window.mainloop()
Código Original : Site do Código
Comentários
Enviar um comentário