win_GUI.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:Automation-Framework-for-devices 作者: tok-gogogo 项目源码 文件源码
def selectComboboxItemThird(hwnd, item):
    try: # item is an index Use this to select
        0 + item
        win32gui.SendMessage(hwnd, win32con.CB_SHOWDROPDOWN, 1, 0)
        win32gui.SendMessage(hwnd, win32con.CB_SETCURSEL, item, 0)
        win32gui.SendMessage(hwnd, win32con.WM_SETFOCUS, 0, 0 )
        time.sleep(1)
        tmp=win32gui.GetWindowRect(hwnd)
        #print 'selectComboboxItemThird',tmp
        '''
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,tmp[0]+1, tmp[1]+1) 
        time.sleep(0.1)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,tmp[0]+1, tmp[1]+1)
        '''
        win32gui.SendMessage(hwnd, win32con.WM_KEYDOWN, 13, 0 )
        time.sleep(0.1)
        win32gui.SendMessage(hwnd, win32con.WM_KEYUP, 13, 0 )
        time.sleep(0.1)
        #_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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号