from tkinter import *
root = Tk()
root.geometry("300x300")
root.resizable(0, 0)
root.config(bg="#d9ead3")
root.title("Classificação Escolar")
def limpar():
nota_entrada.delete(0, END)
def app():
var_nota=nota.get()
if var_nota>20 or var_nota<0:
mensagem = "Erro na digitação."
resultado_texto['fg'] = "red"
elif var_nota<9.5:
mensagem = "Insuficiente"
resultado_texto['fg'] = "red"
elif var_nota<13.5:
mensagem = "Suficiente"
resultado_texto['fg'] = "#00ff00"
elif var_nota<17.5:
mensagem = "Bom"
resultado_texto['fg'] = "#00cc00"
elif var_nota<19.5:
mensagem = "Muito Bom"
resultado_texto['fg'] = "#00b200"
else:
mensagem = "Excelente"
resultado_texto['fg'] = "#007f00"
resultado.set(mensagem)
titulo = Label(text="Classificação Escolar",
font=("Arial", "15", "bold"),bg="#d9ead3",fg="#bf9000")
titulo.place(relx=0.15, rely=0.05)
texto_sub1 = Label(text="Nota:",
font=("Arial", "12", "bold"),bg="#d9ead3",fg="#bf9000")
texto_sub1.place(relx=0.2, rely=0.25)
nota = DoubleVar()
nota_entrada = Entry(textvariable=nota,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
nota_entrada.place(relx=0.45, rely=0.25, relwidth=0.35)
#
but1 = Button(text="Classificar", bd=2, bg='#107db2', fg='white',
font=('verdana', 10, 'bold'), command=app)
but1.place(relx=0.05, rely=0.55, relwidth=0.3, relheight=0.1)
#
but_limpar = Button(text="Limpar", bd=2, bg='#107db2', fg='white',
font=('verdana', 10, 'bold'), command=limpar)
but_limpar.place(relx=0.43, rely=0.55, relwidth=0.2, relheight=0.1)
but_sair = Button(text="Sair", bd=2, bg='#107db2', fg='white',
font=('verdana', 10, 'bold'), command=root.destroy)
but_sair.place(relx=0.7, rely=0.55, relwidth=0.2, relheight=0.1)
resultado = StringVar()
resultado_texto = Label(textvariable=resultado,
font=("Arial", 12, "bold"), bg="#cfe2f3")
resultado_texto.place(relx=0.05, rely=0.8, relwidth=0.9,relheight=0.1)
root.mainloop()