[Tkinter-discuss] Switching focus between different application
Jeff Epler
jepler at unpythonic.net
Mon May 31 11:47:19 EDT 2004
On Unix, Tk supports the "send" command to execute some Tcl command in
the context of a different application. The send manpage mentions that
similar functionality is provided by the "dde" command on Windows. You
would send a command like "raise ." to raise the main window of the
application receiving the command.
Another possibility would be to wrap the win32 "SetWindowPos" API,
as well as implementing some way to get the HWND of the window you want
to raise. Here is how Tk implements the "raise" command on win32:
HWND window = TkWinGetHWND(w)
SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
This would probably not be a difficult project. You could use "ctypes"
to do this on Windows without needing a C compiler. The biggest
difficulty is that the TkWinGetHWND API is an internal API that is
implemented with a C macro.
Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tkinter-discuss/attachments/20040531/aed3c2bb/attachment.bin
More information about the Tkinter-discuss
mailing list