Python Forum
Looping issue, stops working
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Looping issue, stops working
#6
You found it yourself, it's in your edit. You knew that that's the function that was taking time. Also, very near the top of the profile text you shared, was the pixel() call, with a cumulative time almost equal to the time spent in pixelMatchesColor(), meaning that pixelMatchesColor wasn't really slow, it was just waiting for pixel() the entire time.

So I looked up the docs for pyautogui, and it says that pixelMatchesColor is the same thing as pixel(), except that it then checks if the color fits within the passed color parameters. So instead of calling pixel() a lot, I juggled things around to call it just once, and check it's output several times.

I don't think there's any special secret for any of that. Maybe it just takes time programming to be able to have halfway right guesses on where you should start looking :p
Reply


Messages In This Thread
Looping issue, stops working - by JohnOsis - Apr-05-2018, 05:33 PM
RE: Looping issue, stops working - by nilamo - Apr-05-2018, 06:03 PM
RE: Looping issue, stops working - by JohnOsis - Apr-05-2018, 06:41 PM
RE: Looping issue, stops working - by nilamo - Apr-05-2018, 07:07 PM
RE: Looping issue, stops working - by JohnOsis - Apr-05-2018, 07:55 PM
RE: Looping issue, stops working - by nilamo - Apr-05-2018, 08:01 PM
RE: Looping issue, stops working - by JohnOsis - Apr-05-2018, 09:09 PM
RE: Looping issue, stops working - by nilamo - Apr-05-2018, 09:20 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  pip stops waiting for python walker 6 1,154 Nov-28-2023, 06:55 PM
Last Post: walker
  [SOLVED] [Linux] Script in cron stops after first run in loop Winfried 2 968 Nov-16-2022, 07:58 PM
Last Post: Winfried
  Last caracter of a string truncated issue when working from the end of the string Teknohead23 3 1,657 Oct-03-2021, 01:08 PM
Last Post: snippsat
  Know when the pyttsx3 engine stops talking UsualCoder 3 3,307 Aug-29-2021, 11:08 PM
Last Post: snippsat
  IDLE stops responding upon saving tompi1 2 1,983 Oct-01-2020, 05:44 PM
Last Post: Larz60+
  Infinite Looping Issue nsadams87xx 1 1,412 Jun-15-2020, 12:13 AM
Last Post: SheeppOSU
  Python timer script stops before should ozstar 3 2,266 May-04-2020, 12:55 AM
Last Post: ozstar
  Python stops without errors shahgourav 4 2,824 Feb-04-2020, 11:44 PM
Last Post: micseydel
  looping and indentation issue ameydiwanji 3 2,490 Jul-01-2019, 10:53 AM
Last Post: perfringo
  First for loop stops after first iteration Divanova94 10 9,075 May-01-2019, 04:27 PM
Last Post: buran

Forum Jump:

User Panel Messages

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