from tkinter import *
root = Tk()
root.title('Salário')
root.geometry("300x300")
root.resizable(False,False)
def Ok():
sal = salario.get()
if(sal > 50000) :
tax = round((sal * 10/100),2)
elif(sal > 30000) :
tax = round((sal * 5/100),2)
else:
tax = 0
imposto.set(tax)
nsal = sal - tax
salarinet.set(nsal)
salario = DoubleVar()
texto1 = Label(text='Salário Bruto: ',font=("Arial","12","bold"))
texto1.place(relx=0.05,rely=0.1,relwidth=0.4)
salario_entry = Entry(textvariable=salario,justify='center')
salario_entry.place(relx=0.45,rely=0.1,relwidth=0.4)
imposto = StringVar()
salarinet = StringVar()
resultadoimposto = Label(textvariable=imposto,font=("arial","12"),
bg="black",fg="white")
resultadoimposto.place(relx=0.4,rely=0.5,relwidth=0.45)
resultadosal = Label(textvariable=salarinet,font=("arial","12"),
bg="black",fg="white")
resultadosal.place(relx=0.55,rely=0.6,relwidth=0.3)
imposto_Texto2 = Label( text="Imposto:" ,font=("Arial","12","bold"))
imposto_Texto2.place(relx=0.15,rely=0.5,relwidth=0.4)
imposto_Texto3 = Label( text="Salário Líquido:",font=("Arial","12","bold"))
imposto_Texto3.place(relx=0.05,rely=0.6,relwidth=0.4)
bt = Button(text="Calcular",bg='blue',font=("Arial","13","bold"),command=Ok)
bt.place(relx=0.3,rely=0.3,relwidth=0.4,relheight=0.15)
root.mainloop()