import pyautogui
import cv2
import time
while(True):
TradeFrom = pyautogui.locateCenterOnScreen("Screenshot_256.png", grayscale= True, confidence=0.9)
TradeTo = pyautogui.locateCenterOnScreen("Screenshot_258.png", grayscale=True, confidence=0.9)
if TradeFrom == None:
if TradeTo == None:
time.sleep(30)
continue
elif TradeTo != None:
z,t=TradeFrom
pyautogui.moveTo(z,t,3)
pyautogui.rightClick()
#TODO ÇOK YAPILACAK ŞEY VAR AMK
else:
x,y = TradeTo
pyautogui.moveTo(x,y,3)
pyautogui.rightClick()
InviteToParty = pyautogui.locateCenterOnScreen("InviteToParty.png", grayscale= True, confidence=0.9)
Invite_X,Invite_Y = InviteToParty
pyautogui.moveTo(Invite_X,Invite_Y)
Exact output:
Traceback (most recent call last):
File "C:/Users/emosc/PycharmProjects/heuheu/main.py", line 12, in <module>
z,t=TradeFrom
TypeError: cannot unpack non-iterable NoneType object
It is working all fine if I put TradeFrom and TradeTo outside of while loop, can anyone explain why it breaks down after I put it inside while loop?