Python Forum
Check for specific values on screen
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Check for specific values on screen
#1
I am building an autoclicker tool atm with pyautogui and want to make it more intelligent. So I want to replace the wait function with a screen checking modul. For example: Starting a programm that needs 3-5sec for starting. While loading, the screen is for example white at a specific area and when the programm has loaded there are also black colors. Instead of setting a wait function, is there a py modul that can check if the screen has black colors on my screen at the specific area of my screen?
Reply
#2
First off I would highly suggest using a different library such as pynput because pyautogui is very slow. For what you want to do, you'll have to use a combination of two libraries. PIL and cv2. More specifically you just need ImageGrab from PIL, and then cv2 to read it. cv2 will return the data of an image as a list. The list contains more lists each of those is a row. Each row contains a list of colors (I believe) in the form of an rgb list. The thing is you'll have to optimize your code to be as efficient as possible because it can take time to go through so many lists. So the image that you grab should also be as small as possible. Hope this helps
Reply
#3
Hey SheeppOSU,

that helps definetly. Thx for that detailed answer.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Printing specific values out from a dictionary mcoliver88 6 1,317 Apr-12-2023, 08:10 PM
Last Post: deanhystad
  Creating a numpy array from specific values of a spreadsheet column JulianZ 0 1,078 Apr-19-2022, 07:36 AM
Last Post: JulianZ
  Check if specific program is used alex_laco 3 1,559 Feb-23-2022, 05:09 PM
Last Post: ndc85430
  Sum the values in a pandas pivot table specific columns klllmmm 1 4,545 Nov-19-2021, 04:43 PM
Last Post: klllmmm
  Annotating plot bar from values of other a specific column celinafregoso99 0 1,923 Mar-10-2021, 03:19 PM
Last Post: celinafregoso99
  How to access specific values from a dict? t4keheart 6 3,034 Feb-05-2020, 11:34 PM
Last Post: metulburr
  Delete specific lines contain specific words mannyi 2 4,069 Nov-04-2019, 04:50 PM
Last Post: mannyi
  wn = turtle.screen() AttributeError: module 'turtle' has no attribute 'screen' Shadower 1 6,127 Feb-06-2019, 01:25 AM
Last Post: woooee
  Using the and operator to check if two values equal a third DBS 13 11,053 Apr-18-2017, 07:51 PM
Last Post: volcano63
  Check if multiple values exist in a list glidecode 6 47,105 Oct-06-2016, 10:21 PM
Last Post: glidecode

Forum Jump:

User Panel Messages

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