Python Forum
[Tkinter] how to activate Enter key in text box
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] how to activate Enter key in text box
#3
import tkinter as tk

window = tk.Tk()
greeting = tk.Label(text="hello everyone \n what's up")
greeting.pack()

entry = tk.Entry(window)
entry.pack()

text_box = tk.Label('')
text_box.pack()


def on_entry(event):
    text_box['text'] = name = entry.get()
    print(name)


entry.bind('<Return>', on_entry)

window.mainloop()
Reply


Messages In This Thread
RE: how to activate Enter key in text box - by Yoriz - Oct-17-2020, 05:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  neeed to activate a custom tk slider janeik 1 993 Oct-09-2023, 09:29 AM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020