python_by_example/tkgui/sols_124-132/sol_01.py

30 lines
610 B
Python
Raw Normal View History

2023-11-17 13:26:09 -03:00
from tkinter import *
def click():
name = txtbx1.get()
msg = f"Hola {name}"
txtbx2["bg"] = "yellow"
txtbx2["fg"] = "blue"
txtbx2["text"] = msg
window = Tk()
window.geometry("500x200")
lbl1 = Label(text="Ingresa tu nombre:")
lbl1.place(x=30, y=20)
txtbx1 = Entry()
txtbx1.place(x=150, y=20, width=200, height=25)
txtbx1["justify"] = "center"
txtbx1.focus()
btn1 = Button(text="Presioname", command=click)
btn1.place(x=30, y=50, width=120, height=25)
txtbx2 = Message(text="")
txtbx2.place(x=150, y=50, width=200, height=25)
txtbx2["bg"]="white"
txtbx2["fg"]="black"
window.mainloop()