Mundo em Python

Rentabilidade sobre Activos (ROA)

from tkinter import *
root = Tk()
root.geometry("400x400")
root.resizable(0, 0)
root.config(bg="#24577d")
root.title("Rentabilidade sobre Activos")
titulo = Label(text="Rentabilidade sobre Activos ",
font=("Arial", "20", "bold"),bg="#24577d",fg="#22f2da")
titulo.place(relx=0.05, rely=0.05)
texto_sub1 = Label(text="Lucro Líquido:",
font=("Arial", "15", "bold"),bg="#24577d",fg="#22f2da")
texto_sub1.place(relx=0.15, rely=0.25) texto_sub2 = Label(text="Activos Totais:",
font=("Arial", "15", "bold"),bg="#24577d",fg="#22f2da")
texto_sub2.place(relx=0.15, rely=0.45) Lucro_Líquido = DoubleVar()
Lucro_Líquido_entrada = Entry(textvariable=Lucro_Líquido,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Lucro_Líquido_entrada.place(relx=0.55, rely=0.25, relwidth=0.3) Activos_Totais = DoubleVar()
Activos_Totais_entrada = Entry(textvariable=Activos_Totais,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Activos_Totais_entrada.place(relx=0.55, rely=0.45, relwidth=0.3)
def limpar():
Activos_Totais_entrada.delete(0, END)
Lucro_Líquido_entrada.delete(0, END)
resultado.set("") def app():
lucro=Lucro_Líquido.get()
activo =Activos_Totais.get()
ROA = lucro/activo
mensagem =f"Rentabilidade sobre Activos (ROA): {round(ROA,2)}"
resultado.set(mensagem)
but1 = Button(text="Calcular", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=app)
but1.place(relx=0.05, rely=0.6, 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.6, 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.6, 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.75, relwidth=0.9,relheight=0.2) root.mainloop()
0