def dumpWindow(hwnd):
'''Dump all controls from a window into a nested list
Useful during development, allowing to you discover the structure of the
contents of a window, showing the text and class of all contained controls.
Arguments: The window handle of the top level window to dump.
Returns A nested list of controls. Each entry consists of the
control's hwnd, its text, its class, and its sub-controls,
if any.
Usage example: replaceDialog = findTopWindow(wantedText='Replace')
pprint.pprint(dumpWindow(replaceDialog))
'''
windows = []
try:
win32gui.EnumChildWindows(hwnd, _windowEnumerationHandler, windows)
except win32gui.error:
# No child windows
return
windows = [list(window) for window in windows]
for window in windows:
childHwnd, windowText, windowClass = window
window_content = dumpWindow(childHwnd)
if window_content:
window.append(window_content)
return windows
winGuiAuto.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录