[python-win32] Transparent Windows - API failure

Metz, Bobby W, WWCS bwmetz at att.com
Thu Jul 6 01:32:30 CEST 2006


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20060705/a539bea0/attachment.htm 


More information about the Python-win32 mailing list