使用 pywinauto 获取 window 个参数(顶部、底部、右侧、左侧)

Getting window parameters with pywinauto (Top,Bottom,Right,Left)

使用 pywinauto(顶部、底部、右侧、左侧)获取 window 参数

PrintControlIdentifiers()

摘自他们 github 上的文档页面。 https://pywinauto.github.io/docs/code/pywinauto.application.html#pywinauto.application.WindowSpecification.PrintControlIdentifiers

它并没有完全按照我的意愿去做,它在我 运行 的应用程序中寻找一个元素。 (控件标识符)并使用以下参数为我提供它在屏幕上的位置。

(上、下、右、左)

我的问题很简单。是否有一个在更高级别上工作的函数,它不进入 window 的元素,而是只打印 window 的(顶部,底部,右,左)值已打开,但不是它的元素。

只需使用 .Rectangle() 方法并打印其 return 值。

要获得可用方法列表的提示(在交互模式下)方法 .WrapperObject() 很有用(在生产中它被隐式调用)。假设你有

dlg = app.DialogName.WrapperObject()

然后您可以在 IPython/IDLE/python.exe 中键入 dlg. 并获取 window 的可用 methods/properties 列表。或者只使用 print(dir(dlg)).