當前位置: 首頁>>代碼示例>>Python>>正文


Python Quartz.kCGEventOtherMouseUp方法代碼示例

本文整理匯總了Python中Quartz.kCGEventOtherMouseUp方法的典型用法代碼示例。如果您正苦於以下問題:Python Quartz.kCGEventOtherMouseUp方法的具體用法?Python Quartz.kCGEventOtherMouseUp怎麽用?Python Quartz.kCGEventOtherMouseUp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Quartz的用法示例。


在下文中一共展示了Quartz.kCGEventOtherMouseUp方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import Quartz [as 別名]
# 或者: from Quartz import kCGEventOtherMouseUp [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: _mouseUp

# 需要導入模塊: import Quartz [as 別名]
# 或者: from Quartz import kCGEventOtherMouseUp [as 別名]
def _mouseUp(x, y, button):
    if button == LEFT:
        _sendMouseEvent(Quartz.kCGEventLeftMouseUp, x, y, Quartz.kCGMouseButtonLeft)
    elif button == MIDDLE:
        _sendMouseEvent(Quartz.kCGEventOtherMouseUp, x, y, Quartz.kCGMouseButtonCenter)
    elif button == RIGHT:
        _sendMouseEvent(Quartz.kCGEventRightMouseUp, x, y, Quartz.kCGMouseButtonRight)
    else:
        assert False, "button argument not in ('left', 'middle', 'right')" 
開發者ID:asweigart,項目名稱:pyautogui,代碼行數:11,代碼來源:_pyautogui_osx.py

示例3: _click

# 需要導入模塊: import Quartz [as 別名]
# 或者: from Quartz import kCGEventOtherMouseUp [as 別名]
def _click(x, y, button):
    if button == LEFT:
        _sendMouseEvent(Quartz.kCGEventLeftMouseDown, x, y, Quartz.kCGMouseButtonLeft)
        _sendMouseEvent(Quartz.kCGEventLeftMouseUp, x, y, Quartz.kCGMouseButtonLeft)
    elif button == MIDDLE:
        _sendMouseEvent(Quartz.kCGEventOtherMouseDown, x, y, Quartz.kCGMouseButtonCenter)
        _sendMouseEvent(Quartz.kCGEventOtherMouseUp, x, y, Quartz.kCGMouseButtonCenter)
    elif button == RIGHT:
        _sendMouseEvent(Quartz.kCGEventRightMouseDown, x, y, Quartz.kCGMouseButtonRight)
        _sendMouseEvent(Quartz.kCGEventRightMouseUp, x, y, Quartz.kCGMouseButtonRight)
    else:
        assert False, "button argument not in ('left', 'middle', 'right')" 
開發者ID:asweigart,項目名稱:pyautogui,代碼行數:14,代碼來源:_pyautogui_osx.py

示例4: _multiClick

# 需要導入模塊: import Quartz [as 別名]
# 或者: from Quartz import kCGEventOtherMouseUp [as 別名]
def _multiClick(x, y, button, num):
    btn    = None
    down   = None
    up     = None

    if button == LEFT:
        btn  = Quartz.kCGMouseButtonLeft
        down = Quartz.kCGEventLeftMouseDown
        up   = Quartz.kCGEventLeftMouseUp
    elif button == MIDDLE:
        btn  = Quartz.kCGMouseButtonCenter
        down = Quartz.kCGEventOtherMouseDown
        up   = Quartz.kCGEventOtherMouseUp
    elif button == RIGHT:
        btn  = Quartz.kCGMouseButtonRight
        down = Quartz.kCGEventRightMouseDown
        up   = Quartz.kCGEventRightMouseUp
    else:
        assert False, "button argument not in ('left', 'middle', 'right')"
        return

    mouseEvent = Quartz.CGEventCreateMouseEvent(None, down, (x, y), btn)
    Quartz.CGEventSetIntegerValueField(mouseEvent, Quartz.kCGMouseEventClickState, num)
    Quartz.CGEventPost(Quartz.kCGHIDEventTap, mouseEvent)
    Quartz.CGEventSetType(mouseEvent, up)
    Quartz.CGEventPost(Quartz.kCGHIDEventTap, mouseEvent)
    for i in range(0, num-1):
        Quartz.CGEventSetType(mouseEvent, down)
        Quartz.CGEventPost(Quartz.kCGHIDEventTap, mouseEvent)
        Quartz.CGEventSetType(mouseEvent, up)
        Quartz.CGEventPost(Quartz.kCGHIDEventTap, mouseEvent) 
開發者ID:asweigart,項目名稱:pyautogui,代碼行數:33,代碼來源:_pyautogui_osx.py


注:本文中的Quartz.kCGEventOtherMouseUp方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。