Python - force window to render below everything else

375 views Asked by At

I'm trying to do basically what Rainmeter does, but in Python. Does anyone know how to force my window to be below everything else? (And possibly how to let clicks go through to desktop icons?)

I figure this probably needs some ctypes calls into Windows libraries. Someone pointed me at SetWindowPos (winuser.h), but I'm not sure how to hook that.

1

There are 1 answers

0
viilpe On

With pywin32:

import win32con
import win32gui

hwnd = your window handle
win32gui.SetWindowPos(
    hwnd
    , win32con.HWND_BOTTOM
    , 0, 0, 0, 0
    , win32con.SWP_NOSIZE | win32con.SWP_NOACTIVATE | win32con.SWP_NOMOVE
)