[python-win32] keep tkinter window always on top

Mark Hammond mhammond at skippinet.com.au
Mon Aug 22 00:44:12 CEST 2005


> Does anyone know how to keep a tkinter window always on top, despite
> attempts to focus other windows?  Here is my failed attempt.  I've
> tried both tkinter-only and win32-specific solutions.  For this code,
> the window does stay in front of the dos box it's launched from if I
> try to focus the dos box, but that's the only one it stays in front
> of.  Thanks, Benjamin

Try something like:

import win32gui
win32gui.SetWindowPos(hWnd, win32con.HWND_TOPMOST, 0,0,0,0,
win32con.SWP_NOMOVE | win32con.SWP_NOSIZE)

Mark



More information about the Python-win32 mailing list