I want to create a tkinter window that sits beneath all other windows and can't be interacted with using Window's SetWindowPos() function. I would expect the following code to do the trick, but the window that appears is resizable, can accept focus, receives mouse clicks, and is not below everything else.
import time
import ctypes.wintypes
from ctypes import c_bool, c_int
from ctypes.wintypes import HWND, UINT
import tkinter
# Create a window and get its HWND
root = tkinter.Tk()
hwnd = root.winfo_id()
# Flags to move the window to the bottom and keep it from being touched
SWP_NOSIZE = 0x0001
SWP_NOMOVE = 0x0002
SWP_NOACTIVATE = 0x0010
SWP_NOOWNERZORDER = 0x0200
SWP_NOSENDCHANGING = 0x0400
swpFlags = SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSENDCHANGING
SetWindowPos = ctypes.windll.user32.SetWindowPos
SetWindowPos.argtypes = [HWND, HWND, c_int, c_int, c_int, c_int, UINT]
SetWindowPos.restype = c_bool
HWND_BOTTOM = 1
root.update()
SetWindowPos(hwnd, HWND_BOTTOM, 0, 0, 400, 600, swpFlags)
while True:
time.sleep(0.1)
root.update_idletasks()
root.update()