0
我正在尋找使我的wxPython窗口(只有背景)的背景透明。如何在Python中爲Windows hwnd設置透明度鍵?
在Windows中,窗體可以有一個transparency key.這允許用戶通過將背景設置爲透明度鍵顏色來給窗口「透明」背景。
在wx中似乎沒有這樣做的選項。鑑於我的窗口的HWND,我如何直接設置它?
我正在尋找使我的wxPython窗口(只有背景)的背景透明。如何在Python中爲Windows hwnd設置透明度鍵?
在Windows中,窗體可以有一個transparency key.這允許用戶通過將背景設置爲透明度鍵顏色來給窗口「透明」背景。
在wx中似乎沒有這樣做的選項。鑑於我的窗口的HWND,我如何直接設置它?
墨菲定律,我在詢問後立刻找到答案。
win32gui模塊具有設置透明度鍵的功能。
win32gui.SetLayeredWindowAttributes
SetLayeredWindowAttributes(hwnd, Key, Alpha, Flags)
Sets the opacity and transparency color key of a layered window.
Parameters
hwnd : PyHANDLE
handle to the layered window
Key : int
Specifies the color key. Use win32api::RGB to generate value.
Alpha : int
Opacity, in the range 0-255
Flags : int
Combination of win32con.LWA_* values