def selectComboboxItem(hwnd, item):
'''Selects a specified item in a Combo box control.
Arguments:
hwnd Window handle of the required combo box.
item The reqired item. Either an index, of the text of the
required item.
Usage example: fontComboItems = getComboboxItems(fontCombo)
selectComboboxItem(fontCombo,
random.choice(fontComboItems))
'''
try: # item is an index Use this to select
0 + item
win32gui.SendMessage(hwnd, win32con.CB_SETCURSEL, item, 0)
_sendNotifyMessage(hwnd, win32con.CBN_SELCHANGE)
except TypeError: # Item is a string - find the index, and use that
items = getComboboxItems(hwnd)
itemIndex = items.index(item)
selectComboboxItem(hwnd, itemIndex)
winGuiAuto_bak.py 文件源码
python
阅读 30
收藏 0
点赞 0
评论 0
评论列表
文章目录