# pywinauto.findbestmatch
用于查找列表中字符串最接近匹配的模塊
>[success] *異常* `pywinauto.findbestmatch.MatchError(items=None, tofind='')`
找不到合適的匹配
>[success] *類* `pywinauto.findbestmatch.UniqueDict`
處理使其鍵唯一的字典子類
> `find_best_matches(search_text, clean=False, ignore_case=False)`
返回項目中search_text的最佳匹配項
* **search_text** 要查找的文本
* **clean** 是否從字符串中清除非文本字符
* **ignore_case** 比較字符串不區分大小寫
>[success] `pywinauto.findbestmatch.build_unique_dict(controls)`
構建消除歧義的控件列表
分離出不同的功能,以便我們可以獲得用于打印的控件標識符。
>[success] `pywinauto.findbestmatch.find_best_control_matches(search_text, controls)`
返回與search_text最匹配的控件
這與find_best_match稍有不同,因為它構建了要使用每個控件的信息進行搜索的文本項列表。 因此,例如,有一個OK,按鈕,然后以下全部添加到搜索列表:“OK”,“Button”,“OKButton”
但如果有一個ListView(沒有可見的'text'),那么它只會添加“ListView”。
>[success] `pywinauto.findbestmatch.find_best_match(search_text, item_texts, items, limit_ratio=0.5)`
返回與search_text最匹配的項目
* **search_text** 要搜索的文本
* **item_texts** 要搜索的文本列表
* **items** 與要搜索的文本列表相對應的項目列表(1對1)。
* **limit_ratio** 文本與最佳匹配的匹配程度如何。 如果最佳匹配匹配低于此值,則不會將其視為匹配并引發MatchError(默認值= .5)
>[success] `pywinauto.findbestmatch.get_control_names(control, allcontrols, textcontrols)`
返回此控件的名稱列表
>[success] `pywinauto.findbestmatch.``get_non_text_control_name(ctrl, controls, text_ctrls)`
通過查找上方和左側最接近的文本控件返回此控件的名稱
>[success] `pywinauto.findbestmatch.is_above_or_to_left(ref_control, other_ctrl)`
如果other_ctrl在ref_control的上方或左側,則返回true
- 什么是Pywinauto
- 入門指南
- 如何
- 等待長時間操作
- 遠程執行指南
- 每種不同控制類型可用的方法
- 貢獻者
- 開發筆記
- 待辦項目
- 更新日志
- 基本用戶輸入模塊
- pywinauto.mouse
- pywinauto.keyboard
- 主要用戶模塊
- pywinauto.application
- pywinauto.findbestmatch
- pywinauto.findwindows
- pywinauto.timings
- 特定功能
- pywinauto.clipboard
- pywinauto.win32_hooks
- 控件參考
- pywinauto.base_wrapper
- pywinauto.controls.hwndwrapper
- pywinauto.controls.menuwrapper
- pywinauto.controls.common_controls
- pywinauto.controls.win32_controls
- pywinauto.controls.uiawrapper
- pywinauto.controls.uia_controls
- Pre-supplied Tests
- pywinauto.tests.allcontrols
- pywinauto.tests.asianhotkey
- pywinauto.tests.comboboxdroppedheight
- pywinauto.tests.comparetoreffont
- pywinauto.tests.leadtrailspaces
- pywinauto.tests.miscvalues
- pywinauto.tests.missalignment
- pywinauto.tests.missingextrastring
- pywinauto.tests.overlapping
- pywinauto.tests.repeatedhotkey
- pywinauto.tests.translation
- pywinauto.tests.truncation
- 后端內部實施模塊
- pywinauto.backend
- pywinauto.element_info
- pywinauto.win32_element_info
- pywinauto.uia_element_info
- pywinauto.uia_defines
- 內部模塊
- pywinauto.controlproperties
- pywinauto.handleprops
- pywinauto.xml_helpers
- pywinauto.fuzzydict
- pywinauto.actionlogger
- pywinauto.sysinfo
- pywinauto.remote_memory_block