Mundo em Python

Programa Tkinter simples

from tkinter import *
root = Tk()
root.geometry("400x250")
root.resizable(0, 0)
root.config(bg="#d9ead3")
root.title("Programa Tkinter simples")
titulo = Label(text="Programa Tkinter simples",
font=("Arial", "22", "bold"),bg="#d9ead3",fg="#bf9000")
titulo.place(relx=0.05, rely=0.05)
texto_sub1 = Label(text="Nome:",
font=("Arial", "15", "bold"),bg="#d9ead3",fg="#bf9000")
texto_sub1.place(relx=0.2, rely=0.35) nome = StringVar()
nome_entrada = Entry(textvariable=nome,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
nome_entrada.place(relx=0.4, rely=0.35, relwidth=0.5)
def app():
n = nome.get()
mensagem = f"{n} isto é um programa simples python."
resultado.set(mensagem)
def limpar():
nome_entrada.delete(0, END)
resultado.set("") but1 = Button(text="Mostrar", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=app)
but1.place(relx=0.05, rely=0.6, 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.6, 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.6, 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.7, relwidth=0.9,relheight=0.25)
root.mainloop()
0