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


Python Quartz.CGEventCreateMouseEvent方法代码示例

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


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

示例1: _press

# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import CGEventCreateMouseEvent [as 别名]
def _press(self, button):
        (press, _, _), mouse_button = button.value
        event = Quartz.CGEventCreateMouseEvent(
            None,
            press,
            self.position,
            mouse_button)

        # If we are performing a click, we need to set this state flag
        if self._click is not None:
            self._click += 1
            Quartz.CGEventSetIntegerValueField(
                event,
                Quartz.kCGMouseEventClickState,
                self._click)

        Quartz.CGEventPost(Quartz.kCGHIDEventTap, event)

        # Store the button to enable dragging
        self._drag_button = button 
开发者ID:mass-immersion-approach,项目名称:MIA-Dictionary-Addon,代码行数:22,代码来源:_darwin.py

示例2: _release

# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import CGEventCreateMouseEvent [as 别名]
def _release(self, button):
        (_, release, _), mouse_button = button.value
        event = Quartz.CGEventCreateMouseEvent(
            None,
            release,
            self.position,
            mouse_button)

        # If we are performing a click, we need to set this state flag
        if self._click is not None:
            Quartz.CGEventSetIntegerValueField(
                event,
                Quartz.kCGMouseEventClickState,
                self._click)

        Quartz.CGEventPost(Quartz.kCGHIDEventTap, event)

        if button == self._drag_button:
            self._drag_button = None 
开发者ID:mass-immersion-approach,项目名称:MIA-Dictionary-Addon,代码行数:21,代码来源:_darwin.py

示例3: __mouse_event

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

示例4: press

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

示例5: release

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

示例6: doubleClick

# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import CGEventCreateMouseEvent [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

示例7: move_rel

# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import CGEventCreateMouseEvent [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

示例8: _multiClick

# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import CGEventCreateMouseEvent [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

示例9: _sendMouseEvent

# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import CGEventCreateMouseEvent [as 别名]
def _sendMouseEvent(ev, x, y, button):
    mouseEvent = Quartz.CGEventCreateMouseEvent(None, ev, (x, y), button)
    Quartz.CGEventPost(Quartz.kCGHIDEventTap, mouseEvent) 
开发者ID:asweigart,项目名称:pyautogui,代码行数:5,代码来源:_pyautogui_osx.py

示例10: press

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

示例11: release

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

示例12: click

# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import CGEventCreateMouseEvent [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

示例13: rclick

# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import CGEventCreateMouseEvent [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

示例14: doubleclick

# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import CGEventCreateMouseEvent [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

示例15: drag

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


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