本文整理汇总了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")
示例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)
示例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)
示例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)
示例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)