pywinauto iter_children
pywinauto.iter_children is a function in the pywinauto library that returns an iterator that iterates over all the child windows of a given window.
The syntax for using pywinauto.iter_children is:
iter_children(parent_window, **kwargs)
Here, parent_window is the parent window whose child windows we want to iterate over. The **kwargs argument is optional and can be used to filter the child windows based on certain criteria.
The function returns an iterator that can be used in a for loop to iterate over all the child windows of the given parent window. Here is an example:
from pywinauto import Application, Desktop
# start the calculator application
app = Application(backend="uia").start("calc.exe")
# get the calculator window
dlg = Desktop(backend="uia").Calculator
# iterate over all the child windows of the calculator window
for child_window in dlg.children():
print(child_window)
In this example, we start the calculator application and get its main window. We then use pywinauto.iter_children to iterate over all the child windows of the calculator window and print their handles.
原文地址: https://www.cveoy.top/t/topic/bh7y 著作权归作者所有。请勿转载和采集!