NECIP
0
Q:

bind keyboard enter key to a function using tkinter

 pythonCopyimport tkinter as tk

app = tk.Tk()
app.geometry("200x100")

def callback(event):
    label["text"] = "You pressed Enter"

app.bind('<Return>', callback)

label = tk.Label(app, text="")
label.pack()

app.mainloop()
0
entry.bind('<Return>', func)
1

New to Communities?

Join the community