How To Bind The Enter Key To A Button In Tkinter
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
Solution 1:
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:
)
Post a Comment for "How To Bind The Enter Key To A Button In Tkinter"