Mundo em Python

Python Tkinter para exibir dados em caixas de texto

from tkinter import *
root = Tk()
root.title('Python Tkinter para exibir dados em caixas de texto')
root.geometry('500x300')
root.config(bg='#0f4b6e')
root.resizable(0,0)
def app():
i = idade.get()
d = Disciplina.get()
n = nome.get()
mensagem = f'{i} anos {n} tornou-se {d}.'
resultado.set(mensagem) def limpar():
nome_entrada.delete(0, END)
idade_entrada.delete(0, END)
Disciplina_entrada.delete(0, END)
texto_sub1 = Label(text="Nome",
font=("Arial", "13", "bold"),fg="#bf9000",bg='#0f4b6e')
texto_sub1.place(relx=0.45, rely=0.05)
texto_sub2 = Label(text="Idade",
font=("Arial", "13", "bold"),fg="#bf9000",bg='#0f4b6e')
texto_sub2.place(relx=0.45, rely=0.25)
texto_sub3 = Label(text="Disciplina",
font=("Arial", "13", "bold"),fg="#bf9000",bg='#0f4b6e')
texto_sub3.place(relx=0.4, rely=0.45) nome = StringVar()
nome_entrada = Entry(textvariable=nome,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
nome_entrada.place(relx=0.37, rely=0.15, relwidth=0.25)
idade = IntVar()
idade_entrada = Entry(textvariable=idade,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
idade_entrada.place(relx=0.37, rely=0.35, relwidth=0.25) Disciplina = StringVar()
Disciplina_entrada = Entry(textvariable=Disciplina,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Disciplina_entrada.place(relx=0.37, rely=0.55, relwidth=0.25)
#
but1 = Button(text="Mostrar", bd=2, bg='#107db2', fg='white', command=app,
font=('verdana', 12, 'bold'))
but1.place(relx=0.05, rely=0.7, relwidth=0.25, relheight=0.1)
but_limpar = Button(text="Limpar", bd=2, bg='#107db2', fg='white',
font=('verdana', 13, 'bold'), command=limpar)
but_limpar.place(relx=0.35, rely=0.7, relwidth=0.25, relheight=0.1) but_sair = Button(text="Sair", bd=2, bg='#107db2', fg='white',
font=('verdana', 13, 'bold'), command=root.destroy)
but_sair.place(relx=0.65, rely=0.7, relwidth=0.25, relheight=0.1)
resultado = StringVar()
resultado_texto = Label(textvariable=resultado,
font=("Arial", 12, "bold"),bg="#d9ead3",fg="red" )
resultado_texto.place(relx=0.05, rely=0.85, relwidth=0.9,relheight=0.08) root.mainloop()
0