I want to be able to have the Python program itself transparent, but all I could find was running other programs and making them transparent, which is not what I want to do. I just want to make the Python program itself transparent using the win32 module.
Asked
Active
Viewed 973 times
1 Answers
3
So after playing around with a test i did in pygame and reading the answer from here: https://stackoverflow.com/questions/4549213/make-a-window-transparent-using-win32
I managed to get it to work and I also can change colour with colorama so that's good. Here's my code:
import win32gui,win32api,win32con
hwnd = win32gui.FindWindow(None, title)
win32gui.SetWindowLong(hwnd, win32con.GWL_EXSTYLE, win32gui.GetWindowLong(hwnd, win32con.GWL_EXSTYLE) | win32con.WS_EX_LAYERED)
win32gui.SetLayeredWindowAttributes(hwnd, win32api.RGB(0,0,0), 180, win32con.LWA_ALPHA)
So for some strange reason whenever i try to make the program transparent before my loop starts in my program I get a error about "invalid window handle". I do change the program title but I change it before i try the transparency and i update the title with the trancparancy.

Dextron
- 598
- 7
- 24
-
Is there any way to do this type of thing in ubuntu linux? – 255.tar.xz Jul 31 '19 at 03:57
-
I am not sure I haven't looked into it. It also may be different for which screen manager your using such as X11 – Dextron Aug 04 '19 at 02:44