Mundo em Python

Calcular os dividendos

from tkinter import *

root= Tk()
root.geometry("400x400")
root.resizable(0, 0)
root.config(bg="#329ba8")
root.title("Calcular os dividendos")
def limpar():
Valor_Investimento_entrada.delete(0, END)
taxa_dividendos_entrada.delete(0, END)
def app():
v_invest=Valor_Investimento.get()
tx_div=taxa_dividendos.get()
dividendos = v_invest * (tx_div / 100)
dividendosarr = round(dividendos,2)
mensagem = f'Valor dos dividendos: {dividendosarr}'
resultado.set(mensagem)
titulo = Label(text="Calcular os dividendos",
font=("Arial", "20", "bold"),bg="#329ba8",fg="#bfdfe3")
titulo.place(relx=0.15, rely=0.05)
texto_sub1 = Label(text="Valor do Investimento: ",
font=("Arial", "15", "bold"),bg="#329ba8",fg="#bfdfe3")
texto_sub1.place(relx=0.05, rely=0.3) texto_sub2 = Label(text="Taxa Dividendos: ",
font=("Arial", "15", "bold"),bg="#329ba8",fg="#bfdfe3")
texto_sub2.place(relx=0.16, rely=0.45) Valor_Investimento = DoubleVar()
Valor_Investimento_entrada = Entry(textvariable=Valor_Investimento,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Valor_Investimento_entrada.place(relx=0.63, rely=0.3, relwidth=0.3) taxa_dividendos = DoubleVar()
taxa_dividendos_entrada = Entry(textvariable=taxa_dividendos,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
taxa_dividendos_entrada.place(relx=0.63, rely=0.45, relwidth=0.3) #
but1 = Button(text="Verificar", 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