Genius500
Genius500

Reputation: 21

Click on specific area of the Screen using Python

Is it possible to make Python click on a 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 a specific place by itself, maybe with PyAutoGUI.

Upvotes: 1

Views: 4419

Answers (3)

Genius5.00
Genius5.00

Reputation: 11

Just to make it easier for use in code.

import pyautogui

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

click(100, 200) 

Upvotes: 1

James
James

Reputation: 33

import pyautogui
pyautogui.click(100, 100)

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

You can read the docs here

Upvotes: 0

user20753874
user20753874

Reputation:

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.

Upvotes: 2

Related Questions