- Entry
- Label
- Button
Python Tk echo - change text of label
- Entry window, Button, Label where to show the text we typed in.
examples/tk/tk_echo.py
import tkinter as tk def echo(): print('echo') label['text'] = entry.get() app = tk.Tk() app.title('Echo') entry = tk.Entry(app) entry.pack() label = tk.Label(app, text="", width=10, anchor="w") label.pack() echo_button = tk.Button(app, text="Echo", command=echo) echo_button.pack() exit_button = tk.Button(app, text="Exit", fg="red", command=app.destroy) exit_button.pack() app.mainloop()