from tkinter import *
root = Tk()
root.geometry("400x500")
root.resizable(0, 0)
root.config(bg="#141cb3")
root.title("Depósito")
titulo = Label(text="Depósito",
font=("Arial", "45", "bold"),bg="#141cb3",fg="#24b5ab")
titulo.place(relx=0.2, rely=0.05)
texto_sub1 = Label(text="Valor:",
font=("Arial", "25", "bold"),bg="#141cb3",fg="#24b5ab")
texto_sub1.place(relx=0.3, rely=0.25)
texto_sub2 = Label(text="Taxa (em %):",
font=("Arial", "25", "bold"),bg="#141cb3",fg="#24b5ab")
texto_sub2.place(relx=0.05, rely=0.4)
texto_sub3 = Label(text="Prazos (Anos):",
font=("Arial", "25", "bold"),bg="#141cb3",fg="#24b5ab")
texto_sub3.place(relx=0.05, rely=0.55)
valor = DoubleVar()
valor_entrada = Entry(textvariable=valor,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
valor_entrada.place(relx=0.6, rely=0.28, relwidth=0.35)
taxa = DoubleVar()
taxa_entrada = Entry(textvariable=taxa,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
taxa_entrada.place(relx=0.65, rely=0.43, relwidth=0.26)
tempo = IntVar()
tempo_entrada = Entry(textvariable=tempo,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
tempo_entrada.place(relx=0.65, rely=0.57, relwidth=0.26)
#
def limpar():
tempo_entrada.delete(0, END)
taxa_entrada.delete(0, END)
valor_entrada.delete(0, END)
resultado.set("")
def app():
t =tempo.get()
r =taxa.get()
v =valor.get()
rpp = r/100
deposito = (t*rpp*v)+ v
mensagem = f"Valor final do depósito: {round(deposito,2)} €"
resultado.set(mensagem)
but1 = Button(text="Verificar", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=app)
but1.place(relx=0.05, 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.35, 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.65, 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()