Search code examples
pythonpyautogui

How to know if the left mouse click is pressed


I am using PyAutoGUI library. How can I know if the left mouse button is pressed?

This is what I want to do:

if(leftmousebuttonpressed):
   print("left")
else:
   print("nothing")

Solution

  • (I'm the author of PyAutoGUI.) I can confirm that currently PyAutoGUI can't read/record clicks or keystrokes. These features are on the roadmap, but there aren't any resources or timelines dedicated to them currently.