如果按下鼠标,如何使python脚本执行某些操作?

时间:2019-01-26 13:33:16

标签: python-3.x python-2.7 mouseevent

我希望我的python脚本能够在按下鼠标时执行某些任务。这就是我想做的:

if(isset($_POST['show']) && $_POST['show']) {
  echo $_POST['show'];
}

谢谢

1 个答案:

答案 0 :(得分:0)

from pynput.mouse import Listener

def on_click(x, y, button, pressed):
    if pressed:
        print("pressed")
        
with Listener(on_click = on_click) as listener:
    listener.join()