[python-win32] transparency on window

Tim Roberts timr at probo.com
Mon Jan 21 20:05:23 CET 2008


astralrod wrote:
>
> I am doing a script to make a window transparent, but when using the 
> function:
>
> Win32gui.SetLayeredWindowAttributes (918020.127, int (win32api.RGB 
> (255255255)), 0)

This snippet is clearly wrong, because (a) win32gui is not capitalized, 
(b) window handles are not floating point numbers, and (c) the RGB 
function requires three arguments:
    win32api.RGB(255,255,255)

What version of PyWin32 are you running?  Mine doesn't include 
win32gui.SetLayeredWindowAttributes at all.


> It always generates an error, so, I tried to see the attributes of the 
> window with
>
> Win32gui.GetLayeredWindowAttributes (918020), but indicates that the 
> paramete is not correct
>
> The handle what I found with the function win32.FindWindow (None, 
> "*Python Shell*")

Do you mean win32gui.FindWindow?  That calls the API directly, and the 
API doesn't handle wildcards, unless Mark added this in some new 
release.  In addition, Henry is right; you can only call 
SetLayeredWindowAttributes on a window with the WS_EX_LAYERED style.  
You can set that style on a window by using SetWindowLong, although 
there's no telling how the application that owns the window will respond.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list