I couldn’t find any way to get the window handle (Windows) for a window comp, did i miss something?
I want to set a transparency key for the window so i can use it as an overlay over another app. since this option is not available in the window comp I planned on using win32gui python package.
I know i can find it using the window title, but it would nice…
if anyone interested, here is the code i used to solve this one:
def get_hwnds_for_pid (pid):
def callback (hwnd, hwnds):
if win32gui.IsWindowVisible (hwnd) and win32gui.IsWindowEnabled (hwnd):
_, found_pid = win32process.GetWindowThreadProcessId (hwnd)
if found_pid == pid:
hwnds = 
win32gui.EnumWindows (callback, hwnds)
pid = os.getpid()
for hwnd in get_hwnds_for_pid (pid):
if win32gui.GetWindowText (hwnd) == ‘overlay’:
gwl = win32api.GetWindowLong(hwnd, win32con.GWL_EXSTYLE)
win32gui.SetWindowLong(hwnd, win32con.GWL_EXSTYLE, (gwl | win32con.WS_EX_LAYERED))
crkey = win32api.RGB(0,0,0)
flags = (win32con.LWA_COLORKEY)
if (win32gui.SetLayeredWindowAttributes(hwnd, crkey, int(0), flags) != None):
- the full python package called pywin32, and it didn’t work for me when using external python path. only when copying the files (and folders) manually into “site-packages” of TD installation.
So you were able to create windows with Window COMP that were transparent to the windows/desktop behind it?
Oh wow, that is a pretty sweet hack Itay!
Yes, altough it does not do full alpha control just chroma key.
wait wut?? This sounds amazing and needs another look. I still cant get win32api to import
I’m (also) looking to get a window Comp window to have a transparent background and am glad to have found this thread.
Sadly, I am an absolute python noob and don’t really know what to do from here on.
So far I have:
Put the code in a .py, tried to start it via cmd
Put indents where it told me to
Got an error message that said the ‘return True’ is outside of the function or sth
Also put the .py into site-packages, but that didn’t seem to change anything.
Any help would be very welcome!
Thanks in advance!