from tkinter import *
root = Tk()
root.geometry("600x500")
root.resizable(1,1)
root.minsize(300,300)
root.maxsize(600,600)
root.config(bg="#0843a1")
root.title("Prestações para Pagamentos Parcelados")
titulo = Label(text="Prestações para Pagamentos Parcelados",
font=("Arial", "22", "bold"),bg="#0843a1",fg="#d9ead3")
titulo.place(relx=0.03, rely=0.05)
texto_sub1 = Label(text="Total Compra:",
font=("Arial", "20", "bold"),bg="#0843a1",fg="#d9ead3")
texto_sub1.place(relx=0.23, rely=0.25)
texto_sub2 = Label(text="Número de Prestações:",
font=("Arial", "20", "bold"),bg="#0843a1",fg="#d9ead3")
texto_sub2.place(relx=0.05, rely=0.45)
Total_Compra = DoubleVar()
Total_Compra_entrada = Entry(textvariable=Total_Compra,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Total_Compra_entrada.place(relx=0.58, rely=0.26, relwidth=0.3)
Número_Prestações = IntVar()
Número_Prestações_entrada = Entry(textvariable=Número_Prestações,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Número_Prestações_entrada.place(relx=0.58, rely=0.46, relwidth=0.3)
def limpar():
Número_Prestações_entrada.delete(0, END)
Total_Compra_entrada.delete(0, END)
resultado.set("")
def app():
n_p = Número_Prestações.get()
t_c = Total_Compra.get()
prestacao = t_c/n_p
euro = "\u20AC"
mensagem = f'O valor de cada prestação será:{round(prestacao,2)} {euro}'
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()