當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。