Python Forum
[Tkinter] Sections of the code causes the GUI to freeze. What should I do?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Sections of the code causes the GUI to freeze. What should I do?
#4
if pyautogui.locateCenterOnScreen("loot_icon.png", confidence = 0.9):
    ...
pyautogui.locateCenterOnScreen could return None or a tuple with two int.

The if statement asks the object for its boolean. bool(None) evaluates to False.
An empty list, tuple, dict, set, str, bytes, etc. evaluates to False. If they contain elements, then the bool() call returns True.

The result that you want is a non-empty Tuple, so the approach not to check for None, instead check for truthiness, is better.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
RE: Stuck in function - by deanhystad - Dec-27-2022, 10:09 PM
RE: Stuck in function - by Wilkk - Jan-03-2023, 11:36 AM
RE: Stuck in function - by DeaD_EyE - Jan-04-2023, 12:56 PM
RE: Stuck in function - by Wilkk - Jan-07-2023, 08:49 AM
RE: Stuck in function - by Yoriz - Jan-08-2023, 11:32 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] mpv window freeze before video end rfeyer 7 5,422 Feb-20-2021, 09:34 PM
Last Post: rfeyer
  [Tkinter] tkinter freeze DeanAseraf1 0 2,654 Jul-20-2019, 07:46 AM
Last Post: DeanAseraf1
  Tkinter GUI freeze petterg 4 14,127 Jul-01-2019, 03:54 PM
Last Post: petterg
  [Tkinter] GUI Freeze/tkinter SamGer 2 5,575 Jun-24-2019, 07:25 PM
Last Post: noisefloor

Forum Jump:

User Panel Messages

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