I'm writing a small GUI program with python in tkinter for windows. My window has to be in front of a fullscreen game-window.
At the moment, I use this line:
self.root.attributes("-topmost", 1)
which works for normal windows (browser, explorer, ...), but if I start the game to fullscreen mode, my window is hidden behind the game.
Why does this happen? Calls the game maybe something similar to -topmost True
that overrides my attribute?
Is there another solution to my problem? Maybe it is possible to tell windows, that my window should be in front of a specific window (the game window)?
Well, in windows according to this , you should be using the following code to make your job done:
import win32ui, win32con, win32gui
hwnd = int(eval(<toplevel>.wm_frame())) # Get the window info from the
window manager
win32gui.SetWindowPos(hwnd, win32con.HWND_TOPMOST, 0, 0, 0, 0,
win32con.SWP_NOMOVE | win32con.SWP_NOSIZE)
But for this I have my finger crossed as you know the behavior for windows program remains in mystery because its closed source..
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.