Make any Windows window transparentΒΆ

Everything displayed in the Windows user session is ultimately controlled by the Windows GDI Any everything displayed in a users session must run as that user (without modifying kernel or display drivers). Python provides a convenient API to control GDI.

Therefore you can use a few lines of Python to alter the state of any window or process that draws onto the display and make the window invisible, transparent, or even tint it rose.

For GDI details see here

This is how you make any Windows window transparent:

# Make window with Title 'Window Title' invisible
import win32gui,win32api,win32con
window = win32gui.FindWindow(None, "Window Title")
win32gui.SetLayeredWindowAttributes(window, win32api.RGB(0,0,0), 0, win32con.LWA_ALPHA)

#To Dump a list of windows and their tittles
 def callback(hwnd, hwnds):
   print(hex(hwnd), win32gui.GetWindowText(hwnd))

win32gui.EnumWindows(callback, hwnds)


comments powered by Disqus