多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# 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