focus - Manage the input focus
http://purl.org/tcl/home/man/tcl8.5/TkCmd/focus.htm
focus
focus window
focus -displayof window
focus -force window
focus -lastfor window
When is it important to use focus?
To change the order in which focus moves between widgets upon the pressing of 'Tab', either:
RS 2006-05-24: focus -force $toplevel on Windows has the effect of flashing the app's button in the task bar.
MG has found this behaviour to be very erratic. Usually focus (and focus -force) transfer the focus, but occasionally they'll only flash the taskbar button for the app. (wm deiconify does the reverse, usually flashing the taskbar but sometimes giving the app focus instead.) An external lib for flashing the taskbar is far more reliable, from my experience.
MF Focus changes are limited in Windows. Usually stealing focus from other processes is not possible, in such a case the window just flashes (title bar or task bar if not visible). See Remarks section of SetForegroundWindow in msdn [L1 ]
LV What are some techniques when a developer wants to open a Tk window, but does NOT want the desktop mouse focus to move to that window? Right now, the Tk window always pops in front and takes the keyboard focus away from the primary application, which is not helpful in this particular case.