Índice de Rentabilidade

from tkinter import *
root = Tk()
root.geometry("650x400")
root.resizable(0, 0)
root.config(bg="#126969")
root.title("Índice de Rentabilidade")
titulo = Label(text="Índice de Rentabilidade",
font=("Arial", "40", "bold"),bg="#126969",fg="#80eded")
titulo.place(relx=0.05, rely=0.05)

texto_sub1 = Label(text="Valor Presente dos Fluxos de Caixa Futuros:",
font=("Arial", "15", "bold"),bg="#126969",fg="#80eded")
texto_sub1.place(relx=0.04, rely=0.3)

texto_sub2 = Label(text="Investimento Inicial:",
font=("Arial", "15", "bold"),bg="#126969",fg="#80eded")
texto_sub2.place(relx=0.4, rely=0.45)

Valor_Presente = DoubleVar()
Valor_Presente_entrada = Entry(textvariable=Valor_Presente,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Valor_Presente_entrada.place(relx=0.73, rely=0.3, relwidth=0.2)
Investimento_Inicial = DoubleVar()
Investimento_Inicial_entrada = Entry(textvariable=Investimento_Inicial,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Investimento_Inicial_entrada.place(relx=0.73, rely=0.45, relwidth=0.2)
def limpar():
Investimento_Inicial_entrada.delete(0, END)
Valor_Presente_entrada.delete(0, END)
resultado.set("")

def app():
investimento = Investimento_Inicial.get()
vp = Valor_Presente.get()
ir = vp/investimento
if ir>1:
mensagem = f"Classificação: Investimento Atraente\n " \
f"Indica que o valor presente dos fluxos de caixa\n" \
f" futuros é maior do que o investimento inicial. "
elif ir ==1:
mensagem = f"Classificação: Ponto de Equilíbrio\n " \
f"O valor presente dos fluxos de caixa é\n" \
f" exatamente igual ao investimento inicial."
else:
mensagem = f"Classificação: Investimento Não Atraente\n" \
f" Indica que o valor presente dos fluxos de caixa\n" \
f" futuros é menor do que o investimento inicial."

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.55, 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.55, 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.55, 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.7, relwidth=0.9,relheight=0.25)
root.mainloop()

Comentários

Mensagens populares deste blogue

Criar Cartões de Visita

12 signos egípcios

Calcular a percentagem de ocupação