Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set a button as the focus using tkinter?

I want to open a window with the focus set to the first button, so I don't have to tab to it.
If the widget is an Entry widget I can write

widget_name.focus()

There does not appear to be an equivalent for a button widget.

like image 354
Mr May Avatar asked Sep 02 '25 15:09

Mr May


1 Answers

if you are using Tkinter:

buttonname.focus_set()
like image 123
Pakium Avatar answered Sep 05 '25 14:09

Pakium