How to make a frame stay on bottom?

Similar to the STAY_ON_TOP style for frames, is there a way to do the opposite and have the window always be on bottom? I’m trying to make a desktop overlay that uses an invisible frame to display things on what looks like the desktop to the user, but is actually just a frame above it.

Hi, Logan

Yes (for Windows and using pywin32). Try this!

import wx
import win32gui

def stay_on_bottom(self, flag=True):
    hWnd = self.GetHandle()
    hDesktop = win32gui.FindWindow(0, "Program Manager")
    win32gui.SetParent(hWnd, hDesktop if flag else 0)

app = wx.App()
frm = wx.Frame(None, title="Background Frame",
               style=wx.DEFAULT_FRAME_STYLE^wx.MINIMIZE_BOX # Never minimize

The point is to make the window a child of the desktop window.
The source of this idea is [How To] Set a GUI to be " Always at Bottom" - Tutorials - AutoHotkey Community.

1 Like

Thank you so much!
I’d been losing my mind researching this with no results to show for it, I can finally start my project!

I’ve actually run into another issue where when I change the transparency of the frame it becomes completely invisible when I put it on bottom. Even when I set the transparency from 255 to 254, It shows the window properly until it goes to the bottom, anyone know why this happens?

I don’t know why that happens (the window seems to go behind the wallpaper).
On my Windows 10 PC, calling frm.SetTransparent after stay_on_bottom worked fine.