from tkinter import *
root = Tk()
root.geometry("400x400")
root.resizable(0, 0)
root.config(bg="#134591")
root.title("Classificação a Temperatura")
titulo = Label(text="Classificação a Temperatura",
font=("Arial", "20", "bold"),bg="#134591",fg="#bee6e0")
titulo.place(relx=0.03, rely=0.05)
texto_sub1 = Label(text="Temperatura:",
font=("Arial", "15", "bold"),bg="#134591",fg="#bee6e0")
texto_sub1.place(relx=0.15, rely=0.3)
Temperatura = DoubleVar()
Temperatura_entrada = Entry(textvariable=Temperatura,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Temperatura_entrada.place(relx=0.55, rely=0.3, relwidth=0.35)
def limpar():
Temperatura_entrada.delete(0, END)
resultado.set("")
def app():
tempo = Temperatura.get()
if tempo < 0:
mensagem = "Muito Frio"
elif tempo >= 0 and tempo < 15:
mensagem = "Frio"
elif tempo >= 15 and tempo < 25:
mensagem = "Ameno"
elif tempo >= 25 and tempo < 35:
mensagem = "Quente"
else:
mensagem = "Muito Quente"
resultado.set(mensagem)
but1 = Button(text="Classificar", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=app)
but1.place(relx=0.05, rely=0.5, relwidth=0.25, relheight=0.1)
but_limpar = Button(text="Limpar", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=limpar)
but_limpar.place(relx=0.35, rely=0.5, relwidth=0.25, relheight=0.1)
but_sair = Button(text="Sair", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=root.destroy)
but_sair.place(relx=0.65, rely=0.5, relwidth=0.25, relheight=0.1)
resultado = StringVar()
resultado_texto = Label(textvariable=resultado,
font=("Arial", 12, "bold"), bg="#cfe2f3")
resultado_texto.place(relx=0.05, rely=0.68, relwidth=0.9,relheight=0.2)
root.mainloop()