Python win32con 模块,MOUSEEVENTF_LEFTUP 实例源码

我们从Python开源项目中,提取了以下24个代码示例,用于说明如何使用win32con.MOUSEEVENTF_LEFTUP

项目:Automation-Framework-for-devices    作者:tok-gogogo    | 项目源码 | 文件源码
def click_CurrentPlace(self,lb_dx,lb_dy):

        tmp=(string.atoi(lb_dx),string.atoi(lb_dy))

        win32api.SetCursorPos(tmp)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,tmp[0], tmp[1])
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,tmp[0], tmp[1])

    #-----------------------------------------------------------------------------
    # Name:         select_ssid
    # purpose:      select ssid.
    # explain:     
    # Author:       yuanwen
    #
    # Created:      2013/07/5
    #-----------------------------------------------------------------------------
项目: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)
项目:Automation-Framework-for-devices    作者:tok-gogogo    | 项目源码 | 文件源码
def Mouse_LB_Double(self,str_app,lb_dx,lb_dy,Flag='1'):
        time.sleep(1)
        tmp=(string.atoi(lb_dx),string.atoi(lb_dy))
        hwnd = win32gui.FindWindow(None, str_app)
        print 'Mouse_RB str_app,hwnd ',str_app,hwnd
        if hwnd < 1:
            hwnd = self.find_main_window(str_app)

        win32api.SetCursorPos(tmp)

        time.sleep(1)
        #win32api.SetDoubleCIckTime()
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,tmp[0], tmp[1]) 
        time.sleep(0.005)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,tmp[0], tmp[1])
        time.sleep(0.005)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,tmp[0], tmp[1]) 
        time.sleep(0.005)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,tmp[0], tmp[1])
        time.sleep(0.005)
        return True
项目:Automation-Framework-for-devices    作者:tok-gogogo    | 项目源码 | 文件源码
def Mouse_LB_D(self,str_app,lb_dx,lb_dy,Flag='1'):
        time.sleep(1)
        tmp=(string.atoi(lb_dx),string.atoi(lb_dy))
        hwnd = win32gui.FindWindow(None, str_app)
        print 'Mouse_RB str_app,hwnd ',str_app,hwnd
        if hwnd < 1:
            hwnd = self.find_main_window(str_app)

        win32api.SetCursorPos(tmp)

        time.sleep(1)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,tmp[0], tmp[1]) 
        time.sleep(0.05)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,tmp[0], tmp[1])
        time.sleep(0.05)
        return True
项目:Automation-Framework-for-devices    作者:tok-gogogo    | 项目源码 | 文件源码
def click_CurrentPlace(self,lb_dx,lb_dy):

        tmp=(string.atoi(lb_dx),string.atoi(lb_dy))

        win32api.SetCursorPos(tmp)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,tmp[0], tmp[1])
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,tmp[0], tmp[1])

    #-----------------------------------------------------------------------------
    # Name:         select_ssid
    # purpose:      select ssid.
    # explain:     
    # Author:       yuanwen
    #
    # Created:      2013/07/5
    #-----------------------------------------------------------------------------
项目:Email_My_PC    作者:Jackeriss    | 项目源码 | 文件源码
def button_event(content):
    key_table = {'BACKSPACE':8, 'TAB':9, 'TABLE':9, 'CLEAR':12, 'ENTER':13, 'SHIFT':16, 'CTRL':17, 
        'CONTROL':17, 'ALT':18, 'ALTER':18, 'PAUSE':19, 'BREAK':19, 'CAPSLK':20, 'CAPSLOCK':20, 'ESC':27, 
        'SPACE':32, 'SPACEBAR':32, 'PGUP':33, 'PAGEUP':33, 'PGDN':34, 'PAGEDOWN':34, 'END':35, 'HOME':36, 
        'LEFT':37, 'UP':38, 'RIGHT':39, 'DOWN':40, 'SELECT':41, 'PRTSC':42, 'PRINTSCREEN':42, 'SYSRQ':42, 
        'SYSTEMREQUEST':42, 'EXECUTE':43, 'SNAPSHOT':44, 'INSERT':45, 'DELETE':46, 'HELP':47, 'WIN':91, 
        'WINDOWS':91, 'F1':112, 'F2':113, 'F3':114, 'F4':115, 'F5':116, 'F6':117, 'F7':118, 'F8':119, 
        'F9':120, 'F10':121, 'F11':122, 'F12':123, 'F13':124, 'F14':125, 'F15':126, 'F16':127, 'NMLK':144, 
        'NUMLK':144, 'NUMLOCK':144, 'SCRLK':145, 'SCROLLLOCK':145, 'LEFTCLICK':999, 'RIGHTCLICK':1000}
    unrecognized = ''
    key_values = []
    keys = content.split('+')
    for key in keys:
        raw_key = key
        key = key.strip().replace(' ','').upper()
        if key in key_table:
            key_values.append(key_table.get(key))
        elif len(key) == 1:
            key_values.append(ord(key))
        else:
            if key != '':
                unrecognized = raw_key
    for key_value in key_values:
        if key_value == 999:
            win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
        elif key_value == 1000:
            win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
        else:
            win32api.keybd_event(key_value, 0, 0, 0)
        time.sleep(1)
    for i in range(len(key_values)-1, -1, -1):
        if key_value == 999:
            win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
        elif key_value == 1000:
            win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0)
        else:
            win32api.keybd_event(key_values[i], 0, win32con.KEYEVENTF_KEYUP, 0)
        time.sleep(1)
    return unrecognized

#??????????
项目:dfly_edit    作者:Monospark    | 项目源码 | 文件源码
def stop_marking(self):
        if self.__is_marking:
            self.__is_marking = False
            win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
            return True
        return False
项目:ATX    作者:NetEaseGame    | 项目源码 | 文件源码
def _input_left_mouse(self, x, y):
        left, top, right, bottom = self.rect
        width, height = right - left, bottom - top
        if x < 0 or x > width or y < 0 or y > height:
            return

        win32gui.SetForegroundWindow(self.hwnd)
        pos = win32gui.GetCursorPos()
        win32api.SetCursorPos((left+x, top+y))
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)
        win32api.Sleep(100) #ms
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0)
        win32api.Sleep(100) #ms
        # win32api.SetCursorPos(pos)
项目:AutomatorX    作者:xiaoyaojjian    | 项目源码 | 文件源码
def _input_left_mouse(self, x, y):
        left, top, right, bottom = self.rect
        width, height = right - left, bottom - top
        if x < 0 or x > width or y < 0 or y > height:
            return

        win32gui.SetForegroundWindow(self.hwnd)
        pos = win32gui.GetCursorPos()
        win32api.SetCursorPos((left+x, top+y))
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)
        win32api.Sleep(100) #ms
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0)
        win32api.Sleep(100) #ms
        # win32api.SetCursorPos(pos)
项目:FindColor    作者:JarenChow    | 项目源码 | 文件源码
def mouse_click():
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
项目:pyAutoTrading    作者:drongh    | 项目源码 | 文件源码
def clickWindow(hwnd, offset):
    left, top, right, bottom = win32gui.GetWindowRect(hwnd)
    # print('left, top, right, bottom', left, top, right, bottom)
    win32api.SetCursorPos([left + offset, (bottom - top) // 2 + top])
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
    time.sleep(0.2)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
    time.sleep(0.2)
项目:autoops_for_win    作者:qiueer    | 项目源码 | 文件源码
def MouseLUp(cls):
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
        time.sleep(GLB_SLEEP_TIME)
项目:autoops_for_win    作者:qiueer    | 项目源码 | 文件源码
def LClick(cls):
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN|win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
        time.sleep(GLB_SLEEP_TIME)
项目:easytrader    作者:yuzhucu    | 项目源码 | 文件源码
def _mouse_click(x, y):
        win32api.SetCursorPos((x, y))
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y, 0, 0)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)
项目:chessboard_Chinese-chess    作者:JiNianLuo    | 项目源码 | 文件源码
def click(self, x, y):
        win32api.SetCursorPos((x, y))
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
项目:chessboard_Chinese-chess    作者:JiNianLuo    | 项目源码 | 文件源码
def click(self, x, y):
        win32api.SetCursorPos((x, y))
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
项目:chessboard_Chinese-chess    作者:JiNianLuo    | 项目源码 | 文件源码
def click(self, x, y):
        win32api.SetCursorPos((x, y))
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
项目:Automation-Framework-for-devices    作者:tok-gogogo    | 项目源码 | 文件源码
def Mouseclick_lb(self,tmp=(220,230)):
        win32api.SetCursorPos(tmp)
        print 'Mouseclick_lb tmp:',tmp
        time.sleep(1)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,tmp[0], tmp[1]) 
        time.sleep(0.1)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,tmp[0], tmp[1])
        time.sleep(0.1)
        return True
项目:Automation-Framework-for-devices    作者:tok-gogogo    | 项目源码 | 文件源码
def click_CurrentPlace(self,tmp=(259, 178)):

        win32api.SetCursorPos(tmp)
        self.sleep('1')
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,tmp[0], tmp[1])
        self.sleep('0.05')
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,tmp[0], tmp[1])
        self.sleep('0.05')
项目:Automation-Framework-for-devices    作者:tok-gogogo    | 项目源码 | 文件源码
def Mouse_LB_D(self,str_app,lb_dx,lb_dy,Flag='1'):
        time.sleep(1)
        tmp=(string.atoi(lb_dx),string.atoi(lb_dy))
        hwnd = win32gui.FindWindow(None, str_app)
        #msg = 'Mouse_LB str_app,hwnd '+str_app+' '+ str(hwnd)
        #log_print(msg)
        if hwnd > 0:
            win32api.SetCursorPos(tmp)
            time.sleep(1)
            win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,tmp[0], tmp[1]) 
            time.sleep(0.05)
            win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,tmp[0], tmp[1])
            time.sleep(0.05)
            return True
        return False
项目:PyUIA    作者:xiaoxiayu    | 项目源码 | 文件源码
def FX_MouseLClick(x, y):
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
项目:PyUIA    作者:xiaoxiayu    | 项目源码 | 文件源码
def FX_MouseLUp(x, y):
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, int(x), int(y), 0, 0)
项目:py3_scripts    作者:bioinformatist    | 项目源码 | 文件源码
def mouse_click(x=None, y=None):
    if not x is None and not y is None:
        mouse_move(x, y)
        time.sleep(random.random())
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
项目:Zeuz_Python_Node    作者:AutomationSolutionz    | 项目源码 | 文件源码
def Click_Element_None_Mouse(Element,Expand=None,Invoke=None,Select=None,Toggle=None):
    try:
        x = (int)(Element.Current.BoundingRectangle.Right - Element.Current.BoundingRectangle.Width / 2);
        y = (int)(Element.Current.BoundingRectangle.Bottom - Element.Current.BoundingRectangle.Height / 2);
        win32api.SetCursorPos((x,y))

        print "clicking your element"
        patter_list = Element.GetSupportedPatterns()
        for each in patter_list:
            pattern_name = Automation.PatternName(each)
            if pattern_name == "ExpandCollapse":
                if Expand==True:
                    #check to see if its expanded, if expanded, then do nothing... if not, expand it
                    status = Element.GetCurrentPattern(ExpandCollapsePattern.Pattern).Current.ExpandCollapseState
                    if status == 0:
                        Element.GetCurrentPattern(ExpandCollapsePattern.Pattern).Expand()
                    elif status == 1:
                        print "Already Expanded"
                elif Expand == False:
                    #check to see if its Collapsed, if Collapsed, then do nothing... if not, Collapse it
                    status = Element.GetCurrentPattern(ExpandCollapsePattern.Pattern).Current.ExpandCollapseState
                    if status == 1:
                        Element.GetCurrentPattern(ExpandCollapsePattern.Pattern).Collapse()  
                    elif status == 0:
                        print "Already Collapsed"                    



            elif pattern_name == "Invoke":
                if Invoke==True:
                    print "invoking the button: %s" %Element.Current.Name
                    time.sleep(2)
                    Element.GetCurrentPattern(InvokePattern.Pattern).Invoke()



            elif pattern_name == "SelectionItem":
                Element.GetCurrentPattern(SelectionItemPattern.Pattern).Select()
            elif pattern_name == "Toggle":
                Element.GetCurrentPattern(TogglePattern.Pattern).Toggle()
            else:
                #x = int (Element.Current.BoundingRectangle.X)
                #y = int (Element.Current.BoundingRectangle.Y)

                x = (int)(Element.Current.BoundingRectangle.Right - Element.Current.BoundingRectangle.Width / 2);
                y = (int)(Element.Current.BoundingRectangle.Bottom - Element.Current.BoundingRectangle.Height / 2);
                win32api.SetCursorPos((x,y))
                win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
                time.sleep(0.1)
                win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)

    except Exception, e:
        exc_type, exc_obj, exc_tb = sys.exc_info()
        fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
        print ((str(exc_type).replace("type ", "Error Type: ")) + ";" +  "Error Message: " + str(exc_obj) +";" + "File Name: " + fname + ";" + "Line: "+ str(exc_tb.tb_lineno))