from tkinter import *
root = Tk()
root.geometry("400x300")
root.resizable(0, 0)
root.config(bg="#03fce8")
root.title("Obter um Brinde")
def app():
vcompra = Valor_Compra.get()
b = base.get()
brindes = vcompra//b
brindesarr = round(brindes,0)
if brindes<1:
mensagem ="Não tem direito a nenhum brinde."
elif brindes ==1:
mensagem = "Tem direito a 1 a brinde."
else:
mensagem =f"Você tem direito a {brindesarr} brindes!"
resultado.set(mensagem)
def limpar():
Valor_Compra_entrada.delete(0, END)
base_entrada.delete(0, END)
titulo = Label(text="Obter um Brinde",
font=("Arial", "20", "bold"),bg="#03fce8",fg="#fc5603")
titulo.place(relx=0.2, rely=0.05)
texto_sub1 = Label(text="Valor da Compra: ",
font=("Arial", "13", "bold"),bg="#03fce8",fg="#fc5603")
texto_sub1.place(relx=0.15, rely=0.25)
texto_sub2 = Label(text="Por cada Compra: ",
font=("Arial", "13", "bold"),bg="#03fce8",fg="#fc5603")
texto_sub2.place(relx=0.15, rely=0.45)
Valor_Compra = DoubleVar()
Valor_Compra_entrada = Entry(textvariable=Valor_Compra,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Valor_Compra_entrada.place(relx=0.55, rely=0.25, relwidth=0.35)
base = IntVar()
base_entrada = Entry(textvariable=base,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
base_entrada.place(relx=0.55, rely=0.45, relwidth=0.35)
#
but1 = Button(text="Verificar", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=app)
but1.place(relx=0.05, rely=0.65, 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.65, 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.65, relwidth=0.25, relheight=0.1)
resultado = StringVar()
resultado_texto = Label(textvariable=resultado,
font=("Arial", 12, "bold"), bg="#5fc2ba")
resultado_texto.place(relx=0.05, rely=0.85, relwidth=0.9,relheight=0.1)
root.mainloop()