python连击器,供大家参考学习
from pymouse import PyMouseimport time
from pynput import keyboard
import threading
flag = False
def on_press(key):
"""
键盘监听事件!!!
:param key:
:return:
"""
#print(key)
global flag
if key == keyboard.Key.esc:
flag=True
print("stop monitor!")
return False#返回False,键盘监听结束!
def mouseclick():
m = PyMouse()
a = m.position() #获取当前坐标的位置
while True:
m.click(a, a)#移动并且在(x,y)位置左击
#print('dianjile')
time.sleep(0.005)
if flag:
print("测试结束!")
break
#m.click(300, 300, 2) #(300,300)位置右击
if __name__ == '__main__':
print('请将鼠标移动到点击位置,10秒后自动点击')
time.sleep(10)
th=threading.Thread(target=mouseclick)
th.start()
with keyboard.Listener(on_press=on_press) as listener:
listener.join() 老铁,你这个还不如用pyautogui模块,两三行代码就行了
页:
[1]