import time
from pynput.mouse import Button, Controller, Listener
mouse = Controller()
def on_click(x, y, button, pressed):
if button == Button.left:
if pressed:
print("Clicked")
else:
print("unclicked")
with Listener(on_click=on_click) as listener:
listener.join()