当前位置: 首页>>代码示例>>Python>>正文


Python win32con.WM_LBUTTONUP属性代码示例

本文整理汇总了Python中win32con.WM_LBUTTONUP属性的典型用法代码示例。如果您正苦于以下问题:Python win32con.WM_LBUTTONUP属性的具体用法?Python win32con.WM_LBUTTONUP怎么用?Python win32con.WM_LBUTTONUP使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在win32con的用法示例。


在下文中一共展示了win32con.WM_LBUTTONUP属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: click_drag

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_LBUTTONUP [as 别名]
def click_drag(x :int, y :int, x2 :int, y2 :int) -> None:
        """Click at pixel xy."""
        x += Window.x
        y += Window.y
        x2 += Window.x
        y2 += Window.y
        lParam = win32api.MAKELONG(x, y)
        lParam2 = win32api.MAKELONG(x2, y2)
        # MOUSEMOVE event is required for game to register clicks correctly
        win32gui.PostMessage(Window.id, wcon.WM_MOUSEMOVE, 0, lParam)
        while (win32api.GetKeyState(wcon.VK_CONTROL) < 0 or
               win32api.GetKeyState(wcon.VK_SHIFT) < 0 or
               win32api.GetKeyState(wcon.VK_MENU) < 0):
            time.sleep(0.005)
        win32gui.PostMessage(Window.id, wcon.WM_LBUTTONDOWN,
                             wcon.MK_LBUTTON, lParam)
        time.sleep(userset.LONG_SLEEP * 2)
        win32gui.PostMessage(Window.id, wcon.WM_MOUSEMOVE, 0, lParam2)
        time.sleep(userset.SHORT_SLEEP)
        win32gui.PostMessage(Window.id, wcon.WM_LBUTTONUP,
                             wcon.MK_LBUTTON, lParam2)
        time.sleep(userset.MEDIUM_SLEEP) 
开发者ID:kujan,项目名称:NGU-scripts,代码行数:24,代码来源:inputs.py

示例2: ctrl_click

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_LBUTTONUP [as 别名]
def ctrl_click(x :int, y :int) -> None:
        """Clicks at pixel x, y while simulating the CTRL button to be down."""
        x += Window.x
        y += Window.y
        lParam = win32api.MAKELONG(x, y)
        while (win32api.GetKeyState(wcon.VK_CONTROL) < 0 or
               win32api.GetKeyState(wcon.VK_SHIFT) < 0 or
               win32api.GetKeyState(wcon.VK_MENU) < 0):
            time.sleep(0.005)

        win32gui.PostMessage(Window.id, wcon.WM_KEYDOWN, wcon.VK_CONTROL, 0)
        win32gui.PostMessage(Window.id, wcon.WM_LBUTTONDOWN,
                             wcon.MK_LBUTTON, lParam)
        win32gui.PostMessage(Window.id, wcon.WM_LBUTTONUP,
                             wcon.MK_LBUTTON, lParam)
        win32gui.PostMessage(Window.id, wcon.WM_KEYUP, wcon.VK_CONTROL, 0)
        time.sleep(userset.MEDIUM_SLEEP) 
开发者ID:kujan,项目名称:NGU-scripts,代码行数:19,代码来源:inputs.py

示例3: OnTaskbarNotify

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_LBUTTONUP [as 别名]
def OnTaskbarNotify(self, hwnd, msg, wparam, lparam):
        if lparam==win32con.WM_LBUTTONUP:
            print "You clicked me."
        elif lparam==win32con.WM_LBUTTONDBLCLK:
            print "You double-clicked me - goodbye"
            win32gui.DestroyWindow(self.hwnd)
        elif lparam==win32con.WM_RBUTTONUP:
            print "You right clicked me."
            menu = win32gui.CreatePopupMenu()
            win32gui.AppendMenu( menu, win32con.MF_STRING, 1023, "Display Dialog")
            win32gui.AppendMenu( menu, win32con.MF_STRING, 1024, "Say Hello")
            win32gui.AppendMenu( menu, win32con.MF_STRING, 1025, "Exit program" )
            pos = win32gui.GetCursorPos()
            # See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/menus_0hdi.asp
            win32gui.SetForegroundWindow(self.hwnd)
            win32gui.TrackPopupMenu(menu, win32con.TPM_LEFTALIGN, pos[0], pos[1], 0, self.hwnd, None)
            win32gui.PostMessage(self.hwnd, win32con.WM_NULL, 0, 0)
        return 1 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:20,代码来源:win32gui_taskbar.py

示例4: _notify

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_LBUTTONUP [as 别名]
def _notify(klass, hwnd, msg, wparam, lparam):
        self = klass._instance[hwnd]
        if lparam == win32con.WM_LBUTTONDBLCLK:
            menu = self.get_popup()
            wid = win32gui.GetMenuDefaultItem(menu, 0, 0)
            if 0 < wid:
                win32gui.PostMessage(hwnd, win32con.WM_COMMAND, wid, 0)
        elif lparam == win32con.WM_RBUTTONUP:
            menu = self.get_popup()
            pos = win32gui.GetCursorPos()
            win32gui.SetForegroundWindow(hwnd)
            win32gui.TrackPopupMenu(
                menu, win32con.TPM_LEFTALIGN,
                pos[0], pos[1], 0, hwnd, None)
            win32gui.PostMessage(hwnd, win32con.WM_NULL, 0, 0)
        elif lparam == win32con.WM_LBUTTONUP:
            pass
        return True 
开发者ID:euske,项目名称:pyrexecd,代码行数:20,代码来源:__init__.py

示例5: mouse_drag_bg

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_LBUTTONUP [as 别名]
def mouse_drag_bg(self, pos1, pos2):
        """
        后台鼠标拖拽
            :param pos1: (x,y) 起点坐标
            :param pos2: (x,y) 终点坐标
        """
        if self.client == 0:
            move_x = np.linspace(pos1[0], pos2[0], num=20, endpoint=True)[0:]
            move_y = np.linspace(pos1[1], pos2[1], num=20, endpoint=True)[0:]
            win32gui.SendMessage(self.hwnd, win32con.WM_LBUTTONDOWN,
                                 0, win32api.MAKELONG(pos1[0], pos1[1]))
            for i in range(20):
                x = int(round(move_x[i]))
                y = int(round(move_y[i]))
                win32gui.SendMessage(
                    self.hwnd, win32con.WM_MOUSEMOVE, 0, win32api.MAKELONG(x, y))
                time.sleep(0.01)
            win32gui.SendMessage(self.hwnd, win32con.WM_LBUTTONUP,
                                 0, win32api.MAKELONG(pos2[0], pos2[1]))
        else:
            command = str(pos1[0])+' ' + str(pos1[1]) + \
                ' '+str(pos2[0])+' '+str(pos2[1])
            os.system('adb shell input swipe '+command) 
开发者ID:AcademicDog,项目名称:onmyoji_bot,代码行数:25,代码来源:game_ctl.py

示例6: click

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_LBUTTONUP [as 别名]
def click(x :int, y :int, button :str ="left", fast :bool =False) -> None:
        """Click at pixel xy."""
        x += Window.x
        y += Window.y
        lParam = win32api.MAKELONG(x, y)
        # MOUSEMOVE event is required for game to register clicks correctly
        win32gui.PostMessage(Window.id, wcon.WM_MOUSEMOVE, 0, lParam)
        while (win32api.GetKeyState(wcon.VK_CONTROL) < 0 or
               win32api.GetKeyState(wcon.VK_SHIFT) < 0 or
               win32api.GetKeyState(wcon.VK_MENU) < 0):
            time.sleep(0.005)
        if button == "left":
            win32gui.PostMessage(Window.id, wcon.WM_LBUTTONDOWN,
                                 wcon.MK_LBUTTON, lParam)
            win32gui.PostMessage(Window.id, wcon.WM_LBUTTONUP,
                                 wcon.MK_LBUTTON, lParam)
        else:
            win32gui.PostMessage(Window.id, wcon.WM_RBUTTONDOWN,
                                 wcon.MK_RBUTTON, lParam)
            win32gui.PostMessage(Window.id, wcon.WM_RBUTTONUP,
                                 wcon.MK_RBUTTON, lParam)
        # Sleep lower than 0.1 might cause issues when clicking in succession
        if fast:
            time.sleep(userset.FAST_SLEEP)
        else:
            time.sleep(userset.MEDIUM_SLEEP) 
开发者ID:kujan,项目名称:NGU-scripts,代码行数:28,代码来源:inputs.py

示例7: HookMessages

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_LBUTTONUP [as 别名]
def HookMessages(self):
		self.HookMessage(self.OnLButtonUp, win32con.WM_LBUTTONUP)
		self.HookMessage(self.OnLButtonDown, win32con.WM_LBUTTONDOWN)
		self.HookMessage(self.OnLButtonDblClk, win32con.WM_LBUTTONDBLCLK)
		self.HookMessage(self.OnNcLButtonDown, win32con.WM_NCLBUTTONDOWN)
		self.HookMessage(self.OnNcLButtonDblClk, win32con.WM_NCLBUTTONDBLCLK)
		self.HookMessage(self.OnMouseMove, win32con.WM_MOUSEMOVE)
		self.HookMessage(self.OnNcPaint, win32con.WM_NCPAINT)
		self.HookMessage(self.OnCaptureChanged, win32con.WM_CAPTURECHANGED)
		self.HookMessage(self.OnWindowPosChanged, win32con.WM_WINDOWPOSCHANGED)
#		self.HookMessage(self.OnSize, win32con.WM_SIZE) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:13,代码来源:DockingBar.py

示例8: notify

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_LBUTTONUP [as 别名]
def notify(self, hwnd, msg, wparam, lparam):
        if lparam == win32con.WM_LBUTTONDBLCLK:
            self.execute_menu_option(self.default_menu_index + self.FIRST_ID)
        elif lparam == win32con.WM_RBUTTONUP:
            self.show_menu()
        elif lparam == win32con.WM_LBUTTONUP:
            pass
        return True 
开发者ID:samclane,项目名称:LIFX-Control-Panel,代码行数:10,代码来源:SysTrayIcon.py

示例9: click

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_LBUTTONUP [as 别名]
def click(hwnd):
    '''
    模拟鼠标左键单击
    :param hwnd: 要单击的控件、窗体句柄
    :return:
    '''
    win32gui.PostMessage(hwnd, win32con.WM_LBUTTONDOWN, None, None)
    time.sleep(.2)
    win32gui.PostMessage(hwnd, win32con.WM_LBUTTONUP, None, None) 
开发者ID:ynzheng,项目名称:pyautotrade_tdx,代码行数:11,代码来源:winguiauto.py

示例10: click

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_LBUTTONUP [as 别名]
def click(hwnd):
    '''
    模拟鼠标左键单击
    :param hwnd: 要单击的控件、窗体句柄
    :return:
    '''
    win32gui.PostMessage(hwnd, win32con.WM_LBUTTONDOWN, None, None)
    time.sleep(.2)
    win32gui.PostMessage(hwnd, win32con.WM_LBUTTONUP, None, None)
    time.sleep(.2) 
开发者ID:bluestinger,项目名称:PyAutoTrading,代码行数:12,代码来源:winguiauto.py

示例11: OnTaskbarNotify

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_LBUTTONUP [as 别名]
def OnTaskbarNotify(self, hwnd, msg, wparam, lparam):
        """Receive click events from the taskbar."""
        
        #Left click
        if lparam==win32con.WM_LBUTTONUP:
            pass
            
        #Double click (bring to front)
        elif lparam==win32con.WM_LBUTTONDBLCLK:
            
            always_bring_to_front = True
            
            if always_bring_to_front or self.console_hwnd is not None and self.console_hwnd.minimised:
                self.logger.info('Double click to bring window to foreground.')
                self.bring_to_front()
            else:
                self.logger.info('Double click to minimise window.')
                self.minimise_to_tray()
        
        #Right click (load menu)
        elif lparam==win32con.WM_RBUTTONUP:
            self.logger.info('Right click to open menu.')

            for func in self._commands['OnMenuOpen']:
                self.logger.debug('Called "%s" after opening menu.', func.__name__)
                func(self)
            
            #Occasionally the menu may fail to load for some reason, so skip
            try:
                self.show_menu()
            except pywintypes.error:
                return 0
                
            for func in self._commands['OnMenuClose']:
                self.logger.debug('Called "%s" after closing menu.', func.__name__)
                func(self)
        return 1 
开发者ID:Peter92,项目名称:MouseTracks,代码行数:39,代码来源:tray.py

示例12: mouse_click_bg

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_LBUTTONUP [as 别名]
def mouse_click_bg(self, pos, pos_end=None):
        """
        后台鼠标单击
            :param pos: (x,y) 鼠标单击的坐标
            :param pos_end=None: (x,y) 若pos_end不为空,则鼠标单击以pos为左上角坐标pos_end为右下角坐标的区域内的随机位置
        """
        if self.debug_enable:
            img = self.window_full_shot()
            self.img = cv2.rectangle(img, pos, pos_end, (0, 255, 0), 3)

        if pos_end == None:
            pos_rand = pos
        else:
            pos_rand = (random.randint(
                pos[0], pos_end[0]), random.randint(pos[1], pos_end[1]))
        if self.client == 0:
            win32gui.SendMessage(self.hwnd, win32con.WM_MOUSEMOVE,
                                 0, win32api.MAKELONG(pos_rand[0], pos_rand[1]))
            win32gui.SendMessage(self.hwnd, win32con.WM_LBUTTONDOWN,
                                 0, win32api.MAKELONG(pos_rand[0], pos_rand[1]))
            time.sleep(random.randint(20, 80)/1000)
            win32gui.SendMessage(self.hwnd, win32con.WM_LBUTTONUP,
                                 0, win32api.MAKELONG(pos_rand[0], pos_rand[1]))
        else:
            command = str(pos_rand[0]) + ' ' + str(pos_rand[1])
            os.system('adb shell input tap ' + command) 
开发者ID:AcademicDog,项目名称:onmyoji_bot,代码行数:28,代码来源:game_ctl.py

示例13: click

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_LBUTTONUP [as 别名]
def click(hwnd):
    """
    模拟鼠标左键单击
    :param hwnd: 要单击的控件、窗体句柄
    :return:
    """
    win32gui.PostMessage(hwnd, win32con.WM_LBUTTONDOWN, None, None)
    time.sleep(0.2)
    win32gui.PostMessage(hwnd, win32con.WM_LBUTTONUP, None, None)
    time.sleep(0.2) 
开发者ID:drongh,项目名称:pyAutoTrading,代码行数:12,代码来源:winguiauto.py

示例14: OnTaskbarNotify

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_LBUTTONUP [as 别名]
def OnTaskbarNotify(self, hwnd, msg, wparam, lparam):
        if lparam == win32con.WM_LBUTTONDBLCLK:
            self.execute_menu_option(_FIRST_ID)
        elif lparam == win32con.WM_RBUTTONUP:
            self.status_icon.show_menu()
        # elif lparam == win32con.WM_LBUTTONUP:
        #    self._show_console()

        return True 
开发者ID:eavatar,项目名称:eavatar-me,代码行数:11,代码来源:shell.py

示例15: notify

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_LBUTTONUP [as 别名]
def notify(self, hwnd, msg, wparam, lparam):
        if lparam==win32con.WM_LBUTTONDBLCLK:
            self.execute_menu_option(self.default_menu_index + self.FIRST_ID)
        elif lparam==win32con.WM_RBUTTONUP:
            self.show_menu()
        elif lparam==win32con.WM_LBUTTONUP:
            self.show_menu()
        return True 
开发者ID:beville,项目名称:ComicStreamer,代码行数:10,代码来源:gui_win.py


注:本文中的win32con.WM_LBUTTONUP属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。