1

when you want to make a window and its elements clickthrough-able one will probably use code like that:

label = Label(root)

hwnd = label.winfo_id()
styles = win32gui.GetWindowLong(hwnd, win32con.GWL_EXSTYLE)
styles = win32con.WS_EX_LAYERED | win32con.WS_EX_TRANSPARENT
win32gui.SetWindowLong(hwnd, win32con.GWL_EXSTYLE, styles)
win32gui.SetLayeredWindowAttributes(hwnd, 0, 255, win32con.LWA_ALPHA)

Note: you need to use the handle of the elements (here: label) and not the handle of the window (here: root) assuming background of Window is alredy transparent:

root.config(bg='#000000') 
root.attributes('-transparentcolor', '#000000')

Now the Question: how do I revoke the clickthrough? I assume its something like:

def revoke_click_through(hwnd):
    ... #maybe work with new styles?
    win32gui.SetWindowLong(hwnd, ... )
    win32gui.SetLayeredWindowAttributes(hwnd, ... )
Thomas Meyer
  • 384
  • 1
  • 11
  • [Did you See?](https://stackoverflow.com/q/67544105/13629335) – Thingamabobs Oct 13 '21 at 21:24
  • @Atlas435 - yep, there are multiple threats out there(e.q. your mentioned one) but all of them only show how to make clickthrough - not how to undo it – Thomas Meyer Oct 13 '21 at 21:29
  • use `WS_EX_OVERLAPPEDWINDOW` instead of `WS_EX_LAYERED` with same code you did the click through event. Tell me if its help otherwise I need to be on a machine to test it for myself. – Thingamabobs Oct 14 '21 at 16:38

0 Answers0