from tkinter import *
root = Tk()
root.geometry("400x400")
root.resizable(0, 0)
root.title("Ver o seu orçamento")
root.config(bg="#d9ead3")
def limpar():
salario_entrada.delete(0, END)
gastos_entrada.delete(0, END)
def app():
w = salario.get()
g = gastos.get()
o = w-g
if (o>0):
mensagem = "Gastos dentro do Orçamento"
elif o==0:
mensagem = "O salário é igual aos gastos."
else:
mensagem = "Orçamento estourado."
resultado.set(mensagem)
titulo = Label(text="Ver o seu orçamento", font=("Arial", "25", "bold"),
bg="#d9ead3",fg="#bf9000")
titulo.place(relx=0.1, rely=0.05)
salario_texto = Label(text="Digite o seu salário:",
font=("Arial", "12", "bold"),
bg="#d9ead3", fg="#bf9000", justify='center')
salario_texto.place(relx=0.1, rely=0.3, relwidth=0.5)
gastos_texto = Label(text="Digite o seus gastos:",
font=("Arial", "12", "bold"),
bg="#d9ead3", fg="#bf9000", justify='center')
gastos_texto.place(relx=0.1, rely=0.45, relwidth=0.5)
salario = DoubleVar()
salario_entrada = Entry(textvariable=salario,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
salario_entrada.place(relx=0.6, rely=0.3, relwidth=0.25)
gastos = DoubleVar()
gastos_entrada = Entry(textvariable=gastos,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
gastos_entrada.place(relx=0.6, rely=0.45, relwidth=0.25)
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.3, 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.4, 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.7, rely=0.55, relwidth=0.25, relheight=0.1)
resultado = StringVar()
resultado_texto = Label(textvariable=resultado,
font=("Arial", 12, "bold"), bg="#cfe2f3")
resultado_texto.place(relx=0.1, rely=0.8, relwidth=0.8,relheight=0.1)
root.mainloop()