I have a little script in python which is creating a windows popup using tkinter.
Some text to fill and after, two buttons : Dismiss / OK.
I would like to allow the user just to press ‘Enter’ so the OK button is pressed. I mean I would like the OK button to be pre-selected (highlighted) so you can use enter without having to click on it.
I hope I’m clear enough.
Thx !
Use
button.focus()to “pre-select” the button:Or, if you want the Enter key to call
self.on_okglobally, changeok.bindtomaster.bind.