Title: Transparent Windows - API failure

All,
        This is my first attempt with setting transparent backgrounds, so probably simple error.  I've had some success making Notepad transparent, but am getting no results against a Tkinter window.  Also, any workaround to using SetLayeredWindowAttributes on Win2000?  I noticed in the docs it's not in win32gui to prevent issues with NT?

    import win32con
    import win32gui
    import winxpgui

    # Assume you have a tk window open with hWND of 1050292
    # from tkinter import *
    # root = Tk()
    # root['bg'] = "white"

    hWND = 1050292
    win32gui.SetWindowLong (hWND, win32con.GWL_EXSTYLE, win32gui.GetWindowLong (hWND, win32con.GWL_EXSTYLE ) | win32con.WS_EX_LAYERED )

    winxpgui.SetLayeredWindowAttributes(hWND, bgColor, 50, win32con.LWA_COLORKEY|win32con.LWA_ALPHA)

Produces error…

    Traceback (most recent call last):
      File "<pyshell#98>", line 1, in ?
        winxpgui.SetLayeredWindowAttributes(hWND, win32api.RGB(255, 255, 255), 50, win32con.LWA_COLORKEY|win32con.LWA_ALPHA)

    error: (0, 'SetLayeredWindowAttributes', 'No error message is available')

Thanks,

Bobby

_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to