When your application is running, you can
force a widget to have the keyboard focus by calling
focus on that widget:
You might want to do this if you have an
Entry widget into which the user should start typing first. Calling
focus right before
causes the widget to get the focus right away. If you press the Tab
key, the focus automatically changes from one widget to the next.
Shift-Tab can be used to change the focus to the previous widget.
Control-Tab can be used in the Text widget. When in doubt, remember
that you can tell when a widget has the focus by the highlight
rectangle around it.
There are several methods that allow you to manipulate the focus.
To make the focus follow the mouse
out which widget has the focus, call
$who = $widget->focusCurrent;
To force a
widget to have the focus even if the application isn’t
currently active, call
This is not a nice thing to do, so try to not use it.
To find out
which widget had the focus last, call
$which = $widget->focusLast;
If none of the widgets in the window has the focus, the Toplevel is returned.
You can use the
to actually move the focus to the next or previous widget in focus
$nextwidget = $widget->focusNext; $prevwidget = $widget->focusPrev;
So, what is
focus order? First, focus order is constrained
$widget’s Toplevel ...