Python Quartz.CGEventCreateScrollWheelEvent() Examples
The following are 8
code examples of Quartz.CGEventCreateScrollWheelEvent().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
Quartz
, or try the search function
.
Example #1
Source File: _pyautogui_osx.py From pyautogui with BSD 3-Clause "New" or "Revised" License | 6 votes |
def _vscroll(clicks, x=None, y=None): _moveTo(x, y) clicks = int(clicks) for _ in range(abs(clicks) // 10): scrollWheelEvent = Quartz.CGEventCreateScrollWheelEvent( None, # no source Quartz.kCGScrollEventUnitLine, # units 1, # wheelCount (number of dimensions) 10 if clicks >= 0 else -10) # vertical movement Quartz.CGEventPost(Quartz.kCGHIDEventTap, scrollWheelEvent) scrollWheelEvent = Quartz.CGEventCreateScrollWheelEvent( None, # no source Quartz.kCGScrollEventUnitLine, # units 1, # wheelCount (number of dimensions) clicks % 10 if clicks >= 0 else -1 * (-clicks % 10)) # vertical movement Quartz.CGEventPost(Quartz.kCGHIDEventTap, scrollWheelEvent)
Example #2
Source File: _pyautogui_osx.py From pyautogui with BSD 3-Clause "New" or "Revised" License | 6 votes |
def _hscroll(clicks, x=None, y=None): _moveTo(x, y) clicks = int(clicks) for _ in range(abs(clicks) // 10): scrollWheelEvent = Quartz.CGEventCreateScrollWheelEvent( None, # no source Quartz.kCGScrollEventUnitLine, # units 2, # wheelCount (number of dimensions) 0, # vertical movement 10 if clicks >= 0 else -10) # horizontal movement Quartz.CGEventPost(Quartz.kCGHIDEventTap, scrollWheelEvent) scrollWheelEvent = Quartz.CGEventCreateScrollWheelEvent( None, # no source Quartz.kCGScrollEventUnitLine, # units 2, # wheelCount (number of dimensions) 0, # vertical movement (clicks % 10) if clicks >= 0 else (-1 * clicks % 10)) # horizontal movement Quartz.CGEventPost(Quartz.kCGHIDEventTap, scrollWheelEvent)
Example #3
Source File: _pyautogui_osx.py From Dindo-Bot with MIT License | 6 votes |
def _vscroll(clicks, x=None, y=None): _moveTo(x, y) clicks = int(clicks) for _ in range(abs(clicks) // 10): scrollWheelEvent = Quartz.CGEventCreateScrollWheelEvent( None, # no source Quartz.kCGScrollEventUnitLine, # units 1, # wheelCount (number of dimensions) 10 if clicks >= 0 else -10) # vertical movement Quartz.CGEventPost(Quartz.kCGHIDEventTap, scrollWheelEvent) scrollWheelEvent = Quartz.CGEventCreateScrollWheelEvent( None, # no source Quartz.kCGScrollEventUnitLine, # units 1, # wheelCount (number of dimensions) clicks % 10 if clicks >= 0 else -1 * (-clicks % 10)) # vertical movement Quartz.CGEventPost(Quartz.kCGHIDEventTap, scrollWheelEvent)
Example #4
Source File: _pyautogui_osx.py From Dindo-Bot with MIT License | 6 votes |
def _hscroll(clicks, x=None, y=None): _moveTo(x, y) clicks = int(clicks) for _ in range(abs(clicks) // 10): scrollWheelEvent = Quartz.CGEventCreateScrollWheelEvent( None, # no source Quartz.kCGScrollEventUnitLine, # units 2, # wheelCount (number of dimensions) 0, # vertical movement 10 if clicks >= 0 else -10) # horizontal movement Quartz.CGEventPost(Quartz.kCGHIDEventTap, scrollWheelEvent) scrollWheelEvent = Quartz.CGEventCreateScrollWheelEvent( None, # no source Quartz.kCGScrollEventUnitLine, # units 2, # wheelCount (number of dimensions) 0, # vertical movement (clicks % 10) if clicks >= 0 else (-1 * clicks % 10)) # horizontal movement Quartz.CGEventPost(Quartz.kCGHIDEventTap, scrollWheelEvent)
Example #5
Source File: _pyautogui_osx.py From xbmc with GNU General Public License v3.0 | 6 votes |
def _vscroll(clicks, x=None, y=None): _moveTo(x, y) clicks = int(clicks) for _ in range(abs(clicks) // 10): scrollWheelEvent = Quartz.CGEventCreateScrollWheelEvent( None, # no source Quartz.kCGScrollEventUnitLine, # units 1, # wheelCount (number of dimensions) 10 if clicks >= 0 else -10) # vertical movement Quartz.CGEventPost(Quartz.kCGHIDEventTap, scrollWheelEvent) scrollWheelEvent = Quartz.CGEventCreateScrollWheelEvent( None, # no source Quartz.kCGScrollEventUnitLine, # units 1, # wheelCount (number of dimensions) clicks % 10 if clicks >= 0 else -1 * (-clicks % 10)) # vertical movement Quartz.CGEventPost(Quartz.kCGHIDEventTap, scrollWheelEvent)
Example #6
Source File: _pyautogui_osx.py From xbmc with GNU General Public License v3.0 | 6 votes |
def _hscroll(clicks, x=None, y=None): _moveTo(x, y) clicks = int(clicks) for _ in range(abs(clicks) // 10): scrollWheelEvent = Quartz.CGEventCreateScrollWheelEvent( None, # no source Quartz.kCGScrollEventUnitLine, # units 2, # wheelCount (number of dimensions) 0, # vertical movement 10 if clicks >= 0 else -10) # horizontal movement Quartz.CGEventPost(Quartz.kCGHIDEventTap, scrollWheelEvent) scrollWheelEvent = Quartz.CGEventCreateScrollWheelEvent( None, # no source Quartz.kCGScrollEventUnitLine, # units 2, # wheelCount (number of dimensions) 0, # vertical movement (clicks % 10) if clicks >= 0 else (-1 * clicks % 10)) # horizontal movement Quartz.CGEventPost(Quartz.kCGHIDEventTap, scrollWheelEvent)
Example #7
Source File: _darwin.py From MIA-Dictionary-Addon with GNU General Public License v3.0 | 6 votes |
def _scroll(self, dx, dy): while dx != 0 or dy != 0: xval = 1 if dx > 0 else -1 if dx < 0 else 0 dx -= xval yval = 1 if dy > 0 else -1 if dy < 0 else 0 dy -= yval Quartz.CGEventPost( Quartz.kCGHIDEventTap, Quartz.CGEventCreateScrollWheelEvent( None, Quartz.kCGScrollEventUnitPixel, 2, yval * self._SCROLL_SPEED, xval * self._SCROLL_SPEED))
Example #8
Source File: OSXUIFunc.py From Poco with Apache License 2.0 | 5 votes |
def scroll(vertical=None, horizontal=None, depth=None): # Local submethod for generating Mac scroll events in one axis at a time def scroll_event(y_move=0, x_move=0, z_move=0, n=1): for _ in range(abs(n)): scrollWheelEvent = Quartz.CGEventCreateScrollWheelEvent( None, # No source Quartz.kCGScrollEventUnitLine, # Unit of measurement is lines 3, # Number of wheels(dimensions) y_move, x_move, z_move) Quartz.CGEventPost(Quartz.kCGHIDEventTap, scrollWheelEvent) # Execute vertical then horizontal then depth scrolling events if vertical is not None: vertical = int(vertical) if vertical == 0: # Do nothing with 0 distance pass elif vertical > 0: # Scroll up if positive scroll_event(y_move=1, n=vertical) else: # Scroll down if negative scroll_event(y_move=-1, n=abs(vertical)) if horizontal is not None: horizontal = int(horizontal) if horizontal == 0: # Do nothing with 0 distance pass elif horizontal > 0: # Scroll right if positive scroll_event(x_move=1, n=horizontal) else: # Scroll left if negative scroll_event(x_move=-1, n=abs(horizontal)) if depth is not None: depth = int(depth) if depth == 0: # Do nothing with 0 distance pass elif vertical > 0: # Scroll "out" if positive scroll_event(z_move=1, n=depth) else: # Scroll "in" if negative scroll_event(z_move=-1, n=abs(depth))