from tkinter import *
root = Tk()
root.geometry("650x500")
root.resizable(0, 0)
root.config(bg="#276b61")
root.title("Custos de Manutenção")
titulo = Label(text="Custos de Manutenção",
font=("Arial", "43", "bold"),bg="#276b61",fg="#72f7cb")
titulo.place(relx=0.03, rely=0.05)
texto_sub1 = Label(text="Custos de Manutenção Preventiva:",
font=("Arial", "15", "bold"),bg="#276b61",fg="#72f7cb")
texto_sub1.place(relx=0.18, rely=0.25)
texto_sub2 = Label(text="Custos de Manutenção Corretiva:",
font=("Arial", "15", "bold"),bg="#276b61",fg="#72f7cb")
texto_sub2.place(relx=0.18, rely=0.4)
texto_sub3 = Label(text="Outros Custos Relacionados à Manutenção:",
font=("Arial", "15", "bold"),bg="#276b61",fg="#72f7cb")
texto_sub3.place(relx=0.05, rely=0.55)
Custos_Manutenção_Preventiva = DoubleVar()
Custos_Manutenção_Preventiva_entrada = Entry(textvariable=Custos_Manutenção_Preventiva,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Custos_Manutenção_Preventiva_entrada.place(relx=0.73, rely=0.25, relwidth=0.25)
Custos_Manutenção_Corretiva = DoubleVar()
Custos_Manutenção_Corretiva_entrada = Entry(textvariable=Custos_Manutenção_Corretiva,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Custos_Manutenção_Corretiva_entrada.place(relx=0.73, rely=0.4, relwidth=0.25)
Outros_Custos_Relacionado_Manutenção = DoubleVar()
Outros_Custos_Relacionado_Manutenção_entrada = Entry(textvariable=Outros_Custos_Relacionado_Manutenção,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Outros_Custos_Relacionado_Manutenção_entrada.place(relx=0.73, rely=0.55, relwidth=0.25)
def limpar():
Outros_Custos_Relacionado_Manutenção_entrada.delete(0, END)
Custos_Manutenção_Corretiva_entrada.delete(0, END)
Custos_Manutenção_Preventiva_entrada.delete(0, END)
def app():
custos_Corretiva = Custos_Manutenção_Corretiva.get()
Custos_Preventiva = Custos_Manutenção_Preventiva.get()
outros_custos = Outros_Custos_Relacionado_Manutenção.get()
Custos_Manutenção = custos_Corretiva + Custos_Preventiva + outros_custos
mensagem = f"Custo Total de Manutação: {Custos_Manutenção}"
resultado.set(mensagem)
but1 = Button(text="Calcular", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=app)
but1.place(relx=0.1, rely=0.65, 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.4, rely=0.65, 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.7, rely=0.65, 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.8, relwidth=0.9,relheight=0.15)
root.mainloop()