M1 打游戏没有连点器很不爽,自己写了一个!
M1 自带python3 不过安装依赖pip要升级一下!
#coding=utf-8
#!/usr/bin/python3
from pynput.keyboard import Listener
import time
#亲测有效!
from pykeyboard import PyKeyboard
import threading
isrunning = False
keyb = PyKeyboard()
#按键设置
def running():
global isrunning
global keyb
while isrunning:
print("isrunning = ",isrunning)
keyb.press_key('1')
keyb.release_key('1')
time.sleep(0.2)
keyb.press_key('2')
keyb.release_key('2')
time.sleep(0.2)
keyb.press_key('3')
keyb.release_key('3')
time.sleep(0.2)
keyb.press_key('4')
keyb.release_key('4')
time.sleep(0.4)
def switch(key):
# 监听开关
global isrunning
if str(key)=="'"+'l'+"'" :
isrunning = bool(1-isrunning)
if(isrunning):
#启动线程
thread = threading.Thread(target=running,name="runingThread")
thread.start()
# 监听
while True:
with Listener(on_press=switch) as listener:
listener.join()