本文整理汇总了Python中Quartz.kCGEventOtherMouseDown方法的典型用法代码示例。如果您正苦于以下问题:Python Quartz.kCGEventOtherMouseDown方法的具体用法?Python Quartz.kCGEventOtherMouseDown怎么用?Python Quartz.kCGEventOtherMouseDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quartz
的用法示例。
在下文中一共展示了Quartz.kCGEventOtherMouseDown方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import kCGEventOtherMouseDown [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
)
示例2: _mouseDown
# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import kCGEventOtherMouseDown [as 别名]
def _mouseDown(x, y, button):
if button == LEFT:
_sendMouseEvent(Quartz.kCGEventLeftMouseDown, x, y, Quartz.kCGMouseButtonLeft)
elif button == MIDDLE:
_sendMouseEvent(Quartz.kCGEventOtherMouseDown, x, y, Quartz.kCGMouseButtonCenter)
elif button == RIGHT:
_sendMouseEvent(Quartz.kCGEventRightMouseDown, x, y, Quartz.kCGMouseButtonRight)
else:
assert False, "button argument not in ('left', 'middle', 'right')"
示例3: _click
# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import kCGEventOtherMouseDown [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')"
示例4: _multiClick
# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import kCGEventOtherMouseDown [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)