from tkinter import *
root = Tk()
root.title("Calcular taxa por 100 mil habitantes")
root.geometry("400x400")
root.resizable(0, 0)
root.config(bg="#03fcf8")
titulo = Label(text="Calcular taxa por 100 mil habitantes",
font=("Arial", "15", "bold"),bg="#03fcf8",fg="#2803fc")
titulo.place(relx=0.08, rely=0.05)
texto_sub1 = Label(text="Indicador Principal :",
font=("Arial", "13", "bold"),bg="#03fcf8",fg="#2803fc")
texto_sub1.place(relx=0.15, rely=0.25)
texto_sub2 = Label(text="População do Local :",
font=("Arial", "13", "bold"),bg="#03fcf8",fg="#2803fc")
texto_sub2.place(relx=0.13, rely=0.4)
Indicador_Principal = IntVar()
Indicador_Principal_entrada = Entry(textvariable=Indicador_Principal,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Indicador_Principal_entrada.place(relx=0.58, rely=0.25, relwidth=0.35)
População_Local = IntVar()
População_Local_entrada = Entry(textvariable=População_Local,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
População_Local_entrada.place(relx=0.58, rely=0.4, relwidth=0.35)
def limpar():
População_Local_entrada.delete(0, END)
Indicador_Principal_entrada.delete(0, END)
def app():
ip = Indicador_Principal.get()
pl = População_Local.get()
d = ip/pl
taxa_100 =d*100000
taxa_100arr = round(taxa_100,3)
resultado.set(taxa_100arr)
but1 = Button(text="Verificar", 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)
texto_sub3 = Label(text="Taxa por 100 mil hab :",
font=("Arial", "13", "bold"),bg="#03fcf8",fg="#2803fc")
texto_sub3.place(relx=0.05, rely=0.78)
resultado = StringVar()
resultado_texto = Label(textvariable=resultado,
font=("Arial", 12, "bold"), bg="#cfe2f3")
resultado_texto.place(relx=0.55, rely=0.75, relwidth=0.35,relheight=0.1)
root.mainloop()