1

How do I detect a mouse click on screen on a mac?

I have seen many people use win32api however this is only supported for windows, and not for mac also.

Opir
  • 21
  • 2

3 Answers3

1

Similar question with answers:

By using the ctypes module:

Thymen
  • 2,089
  • 1
  • 9
  • 13
0

If you wanna click on the screen with python i recommend you use pyautogui. https://pyautogui.readthedocs.io/en/latest/ If you want to download it onto terminal just type pip install pyautogui!

Here are some clicks you can use:

import pyautogui

pyautogui.click()          # Click the mouse.

pyautogui.click(100, 200)  # Move the mouse to XY coordinates and click it.

pyautogui.click('button.png') # Find where button.png appears on the screen and click it.
Park
  • 2,446
  • 1
  • 16
  • 25
Chungussss
  • 11
  • 1
0

Previous answers were about "controlling" the mouse instead of "monitoring" the mouse.

To monitor mouse activities like clicking, you may refer to pynput

ybbb
  • 30
  • 6