Python Forum
i want to locate an image according to the mouse position
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
i want to locate an image according to the mouse position
#2
img = pyautogui.locateOnScreen('test.png',confidence=0.8,region=(280,284,261,228))

I think... (280,284,261,228) represents (x, y, height, width) of the image you want. So if you use the x,y of your mouse position in there the image location will be the mouse location.

eg: (your_mouse.x - 50, your_mouse.y - 50, 100, 100) will give you a 100x100 square centered on the mouse.
Reply


Messages In This Thread
RE: i want to locate an image according to the mouse position - by michael1789 - Feb-08-2021, 03:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How do I locate setup.py in my computer, or install the file? JaneTan 1 1,698 Aug-26-2021, 08:37 AM
Last Post: snippsat
  Locate QR code on a page Pedroski55 0 1,346 Jan-21-2021, 07:11 AM
Last Post: Pedroski55
Photo Locate Noise floor level for a spectral data in Python Ranjan_Pal 1 2,991 Dec-19-2020, 10:04 AM
Last Post: Larz60+
  How to Locate an Attribute's Parent Object? calvinsomething 5 2,932 Nov-13-2020, 01:52 AM
Last Post: calvinsomething
  Read mouse position on separate between two HDMIs ATARI_LIVE 1 1,383 Sep-28-2020, 07:48 PM
Last Post: ATARI_LIVE
  mouse position biprabu 3 2,003 Sep-09-2020, 08:21 PM
Last Post: deanhystad
  Move mouse and click in particular position biprabu 3 2,441 Sep-01-2020, 08:23 PM
Last Post: deanhystad
  mouse 0.7.0 - mouse polling hate 125-1000hz penahuse 1 2,466 Dec-06-2019, 09:51 PM
Last Post: Larz60+
  trying to locate a working grpc to install MrMajorThorburn 6 4,905 May-10-2019, 01:19 PM
Last Post: MrMajorThorburn
  Locate user input in a string. MjBaca 3 3,172 Apr-23-2018, 06:55 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020