-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
45 lines (39 loc) · 1.02 KB
/
test.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
44
45
import time
from pyautogui import platformModule, _normalizeXYArgs
from pynput import keyboard
execute = False
halt = False
x, y = _normalizeXYArgs(None, None)
#--------------------------------------------
def on_press(key):
try:
if key.char == 'a':
global execute, x, y
execute = not execute
x, y = _normalizeXYArgs(None, None)
except AttributeError:
pass
def on_release(key):
try:
if key.char == 'a':
# global execute
# execute = not execute
# print(execute)
pass
except AttributeError:
if key == keyboard.Key.esc:
global halt
halt = True
return False
listener = keyboard.Listener(
on_press=on_press,
on_release=on_release)
listener.start()
#--------------------------------------------
while not halt:
if execute:
while execute:
time.sleep(0.0005)
platformModule._click(x, y, 'left')
else:
time.sleep(0.01)