如何使用pywinauto使窗口透明?

2024-04-19 10:08:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个无法最小化的窗口。
我必须阻止用户在gui自动化时访问它。
如何用pywinauto来处理这种问题?在

它与autoit和WinSetTrans()函数一起工作。
在pywinauto模块中有类似的东西吗?在


Tags: 模块函数用户guiautoitpywinautowinsettrans
1条回答
网友
1楼 · 发布于 2024-04-19 10:08:26

在pywinauto中没有这样的方法,但是它很容易实现。感谢您的功能请求!在

到目前为止,您可以解决以下问题:

import win32gui, win32api, win32con

hwnd = app.dlg.ctrl.handle
ex_style = app.dlg.ctrl.ExStyle()
win32gui.SetWindowLong (hwnd, win32con.GWL_EXSTYLE, ex_style | win32con.WS_EX_LAYERED )
win32gui.SetLayeredWindowAttributes(hwnd, win32api.RGB(0,0,0), 180, win32con.LWA_ALPHA)

另外,它很快就被改编了from the known answer(我还没有检查过)。我们将在pywinauto0.5.3中包含类似SetTransparent方法的内容(本周计划)。在

相关问题 更多 >