-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.py
43 lines (31 loc) · 1012 Bytes
/
script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from pynput.mouse import Controller, Listener
from time import sleep
mouse = Controller()
pressed = False
released = False
to_subtract = 0
def identifyScroll(posX, posY, button, state):
global to_subtract
global pressed
#print(state)
#if button.name == "middle":
if button.name == "right":
if state:
#print('Pressed')
pressed = True
else:
#print("Released")
pressed = False
if pressed:
to_subtract = posX
else:
toScroll = posX - to_subtract
#print(toScroll)
to_subtract = posX
if toScroll > 0:
toScroll = 400
elif toScroll < 0:
toScroll = -400
mouse.scroll(toScroll*-1, 0)
with Listener(on_click=lambda *args: identifyScroll(args[0], args[1], args[2], args[3])) as l:
l.join()