from tkinter import *
root = Tk()
root.geometry("550x550")
root.resizable(0, 0)
root.config(bg="#103030")
root.title("Olá")
titulo = Label(text="Olá",
font=("Arial", "55", "bold"), bg="#103030", fg="#49e3e3")
titulo.place(relx=0.4, rely=0.05)
texto_sub1 = Label(text="Qual o seu nome?",
font=("Arial", "18", "bold"), bg="#103030", fg="#49e3e3")
texto_sub1.place(relx=0.18, rely=0.23)
texto_sub2 = Label(text="Qual é a sua idade?",
font=("Arial", "18", "bold"), bg="#103030", fg="#49e3e3")
texto_sub2.place(relx=0.16, rely=0.35)
texto_sub3 = Label(text="Em qual cidade você vive?",
font=("Arial", "18", "bold"), bg="#103030", fg="#49e3e3")
texto_sub3.place(relx=0.03, rely=0.45)
texto_sub4 = Label(text="O que você mais ama?",
font=("Arial", "18", "bold"), bg="#103030", fg="#49e3e3")
texto_sub4.place(relx=0.12, rely=0.55)
nome = StringVar()
nome_entrada = Entry(textvariable=nome,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
nome_entrada.place(relx=0.6, rely=0.24, relwidth=0.35)
idade = IntVar()
idade_entrada = Entry(textvariable=idade,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
idade_entrada.place(relx=0.6, rely=0.35, relwidth=0.35)
cidade = StringVar()
cidade_entrada = Entry(textvariable=cidade,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
cidade_entrada.place(relx=0.6, rely=0.45, relwidth=0.35)
ama = StringVar()
ama_entrada = Entry(textvariable=ama,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
ama_entrada.place(relx=0.6, rely=0.55, relwidth=0.35)
def limpar():
idade_entrada.delete(0, END)
ama_entrada.delete(0, END)
cidade_entrada.delete(0, END)
nome_entrada.delete(0, END)
resultado.set("")
def app():
i =idade.get()
love = ama.get()
city = cidade.get()
nom = nome.get()
mensagem = f" Olá o meu nome é {nom} e eu tenho {i} anos.\n" \
f"Eu moro em {city} eu amo {love}"
resultado.set(mensagem)
but1 = Button(text="Mostrar", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=app)
but1.place(relx=0.1, 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.4, 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.7, rely=0.65, relwidth=0.25, relheight=0.1)
resultado = StringVar()
resultado_texto = Label(textvariable=resultado, font=("Arial", 12, "bold"), bg="#cfe2f3")
resultado_texto.place(relx=0.05, rely=0.8, relwidth=0.9, relheight=0.15)
root.mainloop()
Comentários
Enviar um comentário