-
Notifications
You must be signed in to change notification settings - Fork 283
click theRunIsStuck #613
Copy link
Copy link
Closed
Description
from pynput import mouse
from pynput.mouse import Button
isRun = False
ctr = pynput.mouse.Controller()
def g36k():
global isRun
isRun = True
print("start")
# 运行卡死
# theRunIsStuck
ctr.click(Button.left)
print("end")
def on_click(x, y, button, pressed):
print(f'鼠标按下: {button} at ({x}, {y})')
global isRun
# 鼠标松开时触发
if not pressed:
if button == Button.x1 and not isRun:
# 将 g36k 的调用调度到事件循环
g36k()
isRun = False
if __name__ == '__main__':
# 创建鼠标监听器
listener = mouse.Listener(on_click=on_click)
listener.start()
listener.join()
The above is my py code. When I run to ctr.click(Button.left), I can't output print("end "), and my mouse is stuck.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels