def wheel ( delta = 1 ) : location = get_position ( ) e = Quartz . CGEventCreateMouseEvent ( None , Quartz . kCGEventScrollWheel , location , Quartz . kCGMouseButtonLeft ) e2 = Quartz . CGEventCreateScrollWheelEvent ( None , Quartz . kCGScrollEventUnitLine , 1 , delta ) Quartz . CGEventPost ( Quartz . kCGHIDEventTap , e ) Quartz . CGEventPost ( Quartz . kCGHIDEventTap , e2 )
python nouse wheel scrollbar
Sends a wheel event for the provided number of clicks . May be negative to reverse direction .
def wheel(delta=1):
    """ Sends a wheel event for the provided number of clicks. May be negative to reverse
    direction. """
    location = get_position()
    e = Quartz.CGEventCreateMouseEvent(
        None,
        Quartz.kCGEventScrollWheel,
        location,
        Quartz.kCGMouseButtonLeft)
    e2 = Quartz.CGEventCreateScrollWheelEvent(
        None,
        Quartz.kCGScrollEventUnitLine,
        1,
        delta)
    Quartz.CGEventPost(Quartz.kCGHIDEventTap, e)
    Quartz.CGEventPost(Quartz.kCGHIDEventTap, e2)