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


Python Quartz.kCGEventMouseMoved方法代码示例

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


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

示例1: __init__

# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import kCGEventMouseMoved [as 别名]
def __init__(self, callback):
        self.callback = callback

        self.is_recording = False
        self.thread = None

        self.event_tap = Quartz.CGEventTapCreate(
            Quartz.kCGSessionEventTap,
            Quartz.kCGHeadInsertEventTap,
            Quartz.kCGEventTapOptionDefault,
            Quartz.CGEventMaskBit(Quartz.kCGEventKeyDown) |
            Quartz.CGEventMaskBit(Quartz.kCGEventKeyUp) |
            Quartz.CGEventMaskBit(Quartz.kCGEventFlagsChanged) |
            Quartz.CGEventMaskBit(Quartz.kCGEventLeftMouseDown) |
            Quartz.CGEventMaskBit(Quartz.kCGEventLeftMouseUp) |
            Quartz.CGEventMaskBit(Quartz.kCGEventRightMouseDown) |
            Quartz.CGEventMaskBit(Quartz.kCGEventRightMouseUp) |
            Quartz.CGEventMaskBit(Quartz.kCGEventOtherMouseDown) |
            Quartz.CGEventMaskBit(Quartz.kCGEventOtherMouseUp) |
            Quartz.CGEventMaskBit(Quartz.kCGEventMouseMoved) |
            Quartz.CGEventMaskBit(Quartz.kCGEventScrollWheel),
            self.event_handler,
            None
        ) 
开发者ID:SerpentAI,项目名称:sneakysnek,代码行数:26,代码来源:mac_os_recorder.py

示例2: move

# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import kCGEventMouseMoved [as 别名]
def move(self, x, y):
        self.__mouse_event(Quartz.kCGEventMouseMoved, x, y)
        Quartz.CGWarpMouseCursorPosition((x, y)) 
开发者ID:mayank408,项目名称:Mousely,代码行数:5,代码来源:eye_detection.py

示例3: move_rel

# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import kCGEventMouseMoved [as 别名]
def move_rel(self, x, y):
        [x, y] = self.torelative(x, y)
        moveEvent = Quartz.CGEventCreateMouseEvent(None, Quartz.kCGEventMouseMoved, Quartz.CGPointMake(x, y), 0)
        Quartz.CGEventPost(Quartz.kCGHIDEventTap, moveEvent) 
开发者ID:mayank408,项目名称:Mousely,代码行数:6,代码来源:eye_detection.py

示例4: _moveTo

# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import kCGEventMouseMoved [as 别名]
def _moveTo(x, y):
    _sendMouseEvent(Quartz.kCGEventMouseMoved, x, y, 0)
    time.sleep(0.01) # needed to allow OS time to catch up. 
开发者ID:asweigart,项目名称:pyautogui,代码行数:5,代码来源:_pyautogui_osx.py

示例5: move

# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import kCGEventMouseMoved [as 别名]
def move(x, y):
        move = Quartz.CGEventCreateMouseEvent(None, Quartz.kCGEventMouseMoved, (x, y), 0)
        Quartz.CGEventPost(Quartz.kCGHIDEventTap, move) 
开发者ID:AirtestProject,项目名称:Poco,代码行数:5,代码来源:OSXUIFunc.py

示例6: _position_set

# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import kCGEventMouseMoved [as 别名]
def _position_set(self, pos):
        try:
            (_, _, mouse_type), mouse_button = self._drag_button.value
        except AttributeError:
            mouse_type = Quartz.kCGEventMouseMoved
            mouse_button = 0

        Quartz.CGEventPost(
            Quartz.kCGHIDEventTap,
            Quartz.CGEventCreateMouseEvent(
                None,
                mouse_type,
                pos,
                mouse_button)) 
开发者ID:mass-immersion-approach,项目名称:MIA-Dictionary-Addon,代码行数:16,代码来源:_darwin.py

示例7: _handle

# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import kCGEventMouseMoved [as 别名]
def _handle(self, dummy_proxy, event_type, event, dummy_refcon):
        """The callback registered with *Mac OSX* for mouse events.

        This method will call the callbacks registered on initialisation.
        """
        try:
            (px, py) = Quartz.CGEventGetLocation(event)
        except AttributeError:
            # This happens during teardown of the virtual machine
            return

        # Quickly detect the most common event type
        if event_type == Quartz.kCGEventMouseMoved:
            self.on_move(px, py)

        elif event_type == Quartz.kCGEventScrollWheel:
            dx = Quartz.CGEventGetIntegerValueField(
                event,
                Quartz.kCGScrollWheelEventDeltaAxis2)
            dy = Quartz.CGEventGetIntegerValueField(
                event,
                Quartz.kCGScrollWheelEventDeltaAxis1)
            self.on_scroll(px, py, dx, dy)

        else:
            for button in Button:
                try:
                    (press, release, drag), _ = button.value
                except TypeError:
                    # Button.unknown cannot be enumerated
                    continue

                # Press and release generate click events, and drag
                # generates move events
                if event_type in (press, release):
                    self.on_click(px, py, button, event_type == press)
                elif event_type == drag:
                    self.on_move(px, py) 
开发者ID:mass-immersion-approach,项目名称:MIA-Dictionary-Addon,代码行数:40,代码来源:_darwin.py


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