How to know if the left mouse click is pressed

Coding4Life picture Coding4Life · Aug 30, 2016 · Viewed 10.8k times · Source

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")

Answer

Al Sweigart picture Al Sweigart · Mar 19, 2017

(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.