from tkinter import *
root = Tk()
root.geometry("400x600")
root.resizable(0, 0)
root.config(bg="#d9ead3")
root.title("Aplicativo de folha de pagamento simples")
def app():
n = nome.get()
chora = custo_por_hora.get()
numero_horas = numero_de_horas_trabalhadas.get()
ss = Contribuição_SS.get()
seguro = Seguro_Saúde.get()
emprestimo = emprestimo_casa.get()
salario_bruto = chora*numero_horas
imposto = salario_bruto*0.1
total_dedução = imposto + ss + seguro +emprestimo
salario_liquido = salario_bruto-total_dedução
mensagem = f"Dados de {n}.\n Salário Bruto:{salario_bruto}\n" \
f"Impostos:{imposto}\nTotal Gastos: {total_dedução}\n Salário Líquido: {salario_liquido} "
resultado.set(mensagem)
def limpar():
nome_entrada.delete(0, END)
custo_por_hora_entrada.delete(0, END)
emprestimo_casa_entrada.delete(0, END)
Seguro_Saúde_entrada.delete(0, END)
Contribuição_SS_entrada.delete(0, END)
numero_de_horas_trabalhadas_entrada.delete(0, END)
titulo = Label(text="Aplicativo de folha de pagamento simples",
font=("Arial", "13", "bold"),bg="#d9ead3",fg="#bf9000")
titulo.place(relx=0.08, rely=0.05)
texto_sub1= Label(text="Nome de Empregados:",
font=("Arial", "12", "bold"),bg="#d9ead3",fg="#bf9000")
texto_sub1.place(relx=0.05, rely=0.1)
texto_sub2= Label(text="Custo por hora:",
font=("Arial", "12", "bold"),bg="#d9ead3",fg="#bf9000")
texto_sub2.place(relx=0.2, rely=0.2)
texto_sub3= Label(text="Número de horas :",
font=("Arial", "12", "bold"),bg="#d9ead3",fg="#bf9000")
texto_sub3.place(relx=0.15, rely=0.3)
texto_sub4= Label(text="Contribuição para SS :",
font=("Arial", "12", "bold"),bg="#d9ead3",fg="#bf9000")
texto_sub4.place(relx=0.1, rely=0.4)
texto_sub5= Label(text="Seguro de Saúde :",
font=("Arial", "12", "bold"),bg="#d9ead3",fg="#bf9000")
texto_sub5.place(relx=0.1, rely=0.5)
texto_sub6= Label(text="Empréstimo da casa :",
font=("Arial", "12", "bold"),bg="#d9ead3",fg="#bf9000")
texto_sub6.place(relx=0.1, rely=0.6)
nome = StringVar()
nome_entrada = Entry(textvariable=nome,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
nome_entrada.place(relx=0.55, rely=0.1, relwidth=0.43)
custo_por_hora = DoubleVar()
custo_por_hora_entrada = Entry(textvariable=custo_por_hora,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
custo_por_hora_entrada.place(relx=0.6, rely=0.2, relwidth=0.3)
numero_de_horas_trabalhadas = DoubleVar()
numero_de_horas_trabalhadas_entrada = Entry(textvariable=numero_de_horas_trabalhadas,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
numero_de_horas_trabalhadas_entrada.place(relx=0.6, rely=0.3, relwidth=0.3)
Contribuição_SS = DoubleVar()
Contribuição_SS_entrada = Entry(textvariable=Contribuição_SS,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Contribuição_SS_entrada.place(relx=0.6, rely=0.4, relwidth=0.3)
Seguro_Saúde = DoubleVar()
Seguro_Saúde_entrada = Entry(textvariable=Seguro_Saúde,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Seguro_Saúde_entrada.place(relx=0.6, rely=0.5, relwidth=0.3)
emprestimo_casa = DoubleVar()
emprestimo_casa_entrada = Entry(textvariable=emprestimo_casa,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
emprestimo_casa_entrada.place(relx=0.6, rely=0.6, relwidth=0.3)
but1 = Button(text="Calculadora", bd=2, bg='#107db2', fg='white',
font=('verdana', 10, 'bold'), command=app)
but1.place(relx=0.05, rely=0.7, relwidth=0.25, relheight=0.05)
but_limpar = Button(text="Limpar", bd=2, bg='#107db2', fg='white',
font=('verdana', 10, 'bold'), command=limpar)
but_limpar.place(relx=0.35, rely=0.7, relwidth=0.25, relheight=0.05)
but_sair = Button(text="Sair", bd=2, bg='#107db2', fg='white',
font=('verdana', 10, 'bold'), command=root.destroy)
but_sair.place(relx=0.65, rely=0.7, relwidth=0.25, relheight=0.05)
resultado = StringVar()
resultado_texto = Label(textvariable=resultado,
font=("Arial", 12, "bold"),bg="#d9ead3" )
resultado_texto.place(relx=0.05, rely=0.8, relwidth=0.9,relheight=0.18)
root.mainloop()
Comentários
Enviar um comentário