What is the difference between focus and focus_set methods?
Yes, the two are the same thing. To be precise, focus
is an alias for focus_set
. You can see this from a quick test in the interpreter:
>>> import tkinter>>> tkinter.Text.focus is tkinter.Text.focus_set # Same function objectTrue>>>>>> help(tkinter.Text.focus)Help on function focus_set in module tkinter:focus_set(self) Direct input focus to this widget. If the application currently does not have the focus this widget will get the focus if the application gets the focus through the window manager.>>>
Notice how calling help()
on focus
pulls up the documentation for focus_set
.