1

I have a convert button in Tkinter - I want to make it so as that when the user presses the convert button and/or when user presses Enter/Return key the result is generated.

For some reason, I can't get the Enter/Return to bind to anything. I have linked it to master, Label/Entry but it doesn't seem to work. I am not getting any errors but it just isn't doing anything.

This is how I am doing it - Any ideas?

b = Button(master, text='convert', command=passwordgen)
b.bind('<Return>', passwordgen)
b.grid(row=5, column=1, sticky=W)
martineau
  • 119,623
  • 25
  • 170
  • 301
  • 1
    See above link. The accepted demonstrates that you should not bind to the button (`b`) but to the root window (`master`). That works as expected. – wovano Feb 22 '22 at 15:01
  • And of course, you have press enter in the GUI window, not in the Python console. – wovano Feb 22 '22 at 15:02

0 Answers0