0

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)?

Simon Lenz
  • 2,732
  • 5
  • 33
  • 39

1 Answers1

0

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..

Tirtha
  • 529
  • 2
  • 10
  • 23