How to bind the Enter key to a button in Tkinter
python, tkinter
Solution
You need to use a lambda if you're passing arguments.
app.bind("<Return>", lambda x: showLDAPMembers(yourName,yourPassword))
The `bind` command automatically returns the event that called it, so you need to define and throw away that (with `lambda x:`)
Problem
I have a button: ``` button3 = Button(app, text="Show Members", width=15, command=lambda: showLDAPMembers(yourName,yourPassword)) ``` How do I bind the ENTER key to it? I tried doing: ``` app.bind('<Return>', showLDAPMembers(yourName,yourPassword)) ``` but I get unresolved reference error.. ``` def showLDAPMembers(yourName,yourPassword): app.lb.delete(0,END) ```