Apr-04-2020, 07:20 PM
(This post was last modified: Apr-04-2020, 07:20 PM by deanhystad.)
pressed_enter is a function. You can bind a function. pressed_enter() calls the function and is the function's return value (None). You cannot bind None.
root.bind("<Return>", pressed_enter())This code works:
import tkinter as tk def pressed_enter(event): print(event) def pressed_F1(event): print(event) def pressed_btn1(event): print(event) root = tk.Tk() root.geometry('200x250') root.bind("<Return>", pressed_enter) root.bind("<KeyPress-F1>", pressed_F1) root.bind("<Button-1>", pressed_btn1) root.mainloop()