So I was trying to make a ‘desktop’ based game, a bit like desktop goose where the game is ‘on’ the desktop.
To do this, I made a transparent Pygame window but at the moment, it shows up whenever you focus the window regardless of layer (which makes sense). However, I am trying to find a way to make it ALWAYS stay on the bottom layer in terms of the window’s that a user has open, to give the impression its ‘stuck’ on the desktop. I’ve done a lot of googling and only found Tkinter solutions, but nothing in terms of locking the window down when it comes to using Pygame.
Does anyone else have a clue or idea about how I could do this? I assume there would be some kind of need to use the win32 modules for Windows, just not sure how.
UPDATE: I did find this, but ran the raw code and it didn’t work as expected (no errors, just not as the title says)
Always keep window on bottom in Python for Windows and pygame
I believe this would be the main line I need to focus on:
win32gui.SetWindowPos(hwnd,win32con.HWND_BOTTOM, 0, 0, 0, 0,win32con.SWP_NOMOVE + win32con.SWP_NOSIZE)
I have tried using some of the parameter options from these docs in the above line of code, but as I’m not proficient in pywin32 I’m not sure how to do so and have it work
Leave an answer