Home > Mobile >  Click on specific area of the Screen using Python
Click on specific area of the Screen using Python

Time:12-30

Is it possible to make python click on specific area of the screen? For example, I want it to move the cursor and click near the upper right corner of the screen on specific place by itself. Maybe with pyautogui.

CodePudding user response:

using pyautogui this can be easily done.

you can get pyautogui using pip install pyautogui in the terminal. if that didn't work use pip install PyAutoGUI. than using the code bellow you can click anywhere on the screen

import pyautogui

pyautogui.click(100,200)
                #x , y

read more about pyautogui here

Try searching things in googles more often before asking question in stack overflow or other places, this could result in learning python and other thing way faster, for example when I searched your questions title the first thing that came up instantly gave me the answer.

CodePudding user response:

import pyautogui
pyautogui.click(100, 100)

Where x and y coordinates go in .click(x, y)

You can read the docs here

CodePudding user response:

Just to make it easier for use in code.

import pyautogui

def click(a, b):
    pyautogui.click(a, b)

click(100, 200) 
  • Related