Mundo em Python

Aprovado Na Disciplina

from tkinter import *
root = Tk()
root.title("Ver se for aprovado")
root.geometry("400x400")
root.configure(bg="#cfe2f3")
root.resizable(0,0) def limpar():
nota1_entrada.delete(0, END)
nota2_entrada.delete(0, END)
def app():
n1 =nota1.get()
n2 =nota2.get()
nt= n1+n2
m = nt/2
marr = round(m,2)
if marr < 7.0:
mensagem='Reprovado'
elif marr < 10:
mensagem='Aprovado'
else:
mensagem='Aprovado com Distinção!'
resultado.set(mensagem) titulo = Label(text="Aprovação dos Alunos ",bg="#cfe2f3",fg="#ba990a",
font=("Arial","13","bold"))
titulo.place(relx=0.25,rely=0.05)
Exame1_Texto = Label(text="Teste 1: ",bg="#cfe2f3",fg="#ba990a",
font=("Arial","12","bold"))
Exame1_Texto.place(relx=0.2,rely=0.2)
nota1 = DoubleVar()
nota1_entrada= Entry(textvariable=nota1,font=("Arial","12","bold"),
bg="white",fg="blue",justify='center')
nota1_entrada.place(relx=0.45,rely=0.2,relwidth=0.25)
Exame2_Texto = Label(text="Teste 2: ",bg="#cfe2f3",fg="#ba990a",
font=("Arial","12","bold"))
Exame2_Texto.place(relx=0.2,rely=0.35)
nota2 = DoubleVar()
nota2_entrada= Entry(textvariable=nota2,font=("Arial","12","bold"),
bg="white",fg="blue",justify='center')
nota2_entrada.place(relx=0.45,rely=0.35,relwidth=0.25)
but1 = Button( text="Calcular", bd=2, bg='#107db2', fg='white',
font=('verdana', 13, 'bold'),command=app)
but1.place(relx=0.15, rely=0.5, relwidth=0.3, relheight=0.1)
butlimpar = Button( text="Limpar", bd=2, bg='#107db2', fg='white',
font=('verdana', 13, 'bold'),command=limpar)
butlimpar.place(relx=0.55, rely=0.5, relwidth=0.3, relheight=0.1)
resultado = StringVar()
vresultado = Label(textvariable=resultado,font=("Arial",12,"bold"),
bg="#c0d6e4",fg="#466a8d")
vresultado.place(relx=0.1,rely=0.7,relwidth=0.8)
root.mainloop()
0