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


Python Quartz.CGEventSetType方法代碼示例

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


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

示例1: doubleClick

# 需要導入模塊: import Quartz [as 別名]
# 或者: from Quartz import CGEventSetType [as 別名]
def doubleClick(self, x, y, clickCount, button=0):
        print("Double click event")
        theEvent = Quartz.CGEventCreateMouseEvent(None, Mouse.down[button], (x, y), button)
        Quartz.CGEventSetIntegerValueField(theEvent, Quartz.kCGMouseEventClickState, clickCount)
        Quartz.CGEventPost(Quartz.kCGHIDEventTap, theEvent)
        Quartz.CGEventSetType(theEvent, Quartz.kCGEventLeftMouseUp)
        Quartz.CGEventPost(Quartz.kCGHIDEventTap, theEvent)
        Quartz.CGEventPost(Quartz.kCGHIDEventTap, theEvent)
        Quartz.CGEventSetType(theEvent, Quartz.kCGEventLeftMouseDown)
        Quartz.CGEventPost(Quartz.kCGHIDEventTap, theEvent)
        Quartz.CGEventSetType(theEvent, Quartz.kCGEventLeftMouseUp)
        Quartz.CGEventPost(Quartz.kCGHIDEventTap, theEvent)
        print("Double click event ended") 
開發者ID:mayank408,項目名稱:Mousely,代碼行數:15,代碼來源:eye_detection.py

示例2: _multiClick

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

示例3: click

# 需要導入模塊: import Quartz [as 別名]
# 或者: from Quartz import CGEventSetType [as 別名]
def click(x, y, button=1):
        theEvent = Quartz.CGEventCreateMouseEvent(None, pressID[button], (x, y), button - 1)
        Quartz.CGEventPost(Quartz.kCGHIDEventTap, theEvent)  
        Quartz.CGEventSetType(theEvent, Quartz.kCGEventLeftMouseUp)  
        Quartz.CGEventPost(Quartz.kCGHIDEventTap, theEvent) 
開發者ID:AirtestProject,項目名稱:Poco,代碼行數:7,代碼來源:OSXUIFunc.py

示例4: rclick

# 需要導入模塊: import Quartz [as 別名]
# 或者: from Quartz import CGEventSetType [as 別名]
def rclick(x, y, button=2):
        theEvent = Quartz.CGEventCreateMouseEvent(None, pressID[button], (x, y), button - 1)
        Quartz.CGEventPost(Quartz.kCGHIDEventTap, theEvent)  
        Quartz.CGEventSetType(theEvent, releaseID[button])  
        Quartz.CGEventPost(Quartz.kCGHIDEventTap, theEvent) 
開發者ID:AirtestProject,項目名稱:Poco,代碼行數:7,代碼來源:OSXUIFunc.py

示例5: doubleclick

# 需要導入模塊: import Quartz [as 別名]
# 或者: from Quartz import CGEventSetType [as 別名]
def doubleclick(x, y, button=1):
        theEvent = Quartz.CGEventCreateMouseEvent(None, pressID[button], (x, y), button - 1)
        Quartz.CGEventSetIntegerValueField(theEvent, Quartz.kCGMouseEventClickState, 2)  
        Quartz.CGEventPost(Quartz.kCGHIDEventTap, theEvent)  
        Quartz.CGEventSetType(theEvent, Quartz.kCGEventLeftMouseUp)  
        Quartz.CGEventPost(Quartz.kCGHIDEventTap, theEvent)  
        Quartz.CGEventSetType(theEvent, Quartz.kCGEventLeftMouseDown) 
        Quartz.CGEventPost(Quartz.kCGHIDEventTap, theEvent)
        Quartz.CGEventSetType(theEvent, Quartz.kCGEventLeftMouseUp)
        Quartz.CGEventPost(Quartz.kCGHIDEventTap, theEvent) 
開發者ID:AirtestProject,項目名稱:Poco,代碼行數:12,代碼來源:OSXUIFunc.py


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