Traceback (most recent call last):
File "C:/Users/yaahy/PycharmProjects/Testing/testing1.py", line 45, in
<module>
clicktheshit()
File "C:/Users/yaahy/PycharmProjects/Testing/testing1.py", line 41, in
clicktheshit
pyautogui.click(chords[0], chords[1])
TypeError: 'NoneType' object is not subscriptable
, так как мой скрипт выполняет медленный поиск по каждому пикселю, я хочу ускорить его, вырезав некоторые бесполезные пиксели, которые он просматривает (которых нет в игровом регионе), но используя
pxlss = pxls[60:400]
не работает, я не знаю проблемы, потому что она работает без попыток вырезать ненужные вещи, просто медленно
import pyautogui
import time
from PIL import Image
import mss
import mss.tools
import cv2
import numpy as np
from PIL import ImageGrab
import colorsys
time.sleep(2)
def shootfunc(xc, yc):
pyautogui.click(xc, yc)
gameregion = [71, 378, 328, 530]
def findpixels(pxls):
pxlss = pxls[60:400]
for row, pxl in enumerate(pxlss):
for col, pxll in enumerate(pxl):
if col >= 536 and col <= 808 and row <= 515 and row >= 371 and pxll == (102, 102, 102):
foundpxl = pxll
print(str(col) + " , " + str(row))
return [col, row]
break
def clicktheshit():
with mss.mss() as sct:
region = {'top': 0, 'left': 0, 'width': 1920, 'height': 1080}
imgg = sct.grab(region)
pxls = imgg.pixels
chords = findpixels(pxls)
pyautogui.click(chords[0], chords[1])
xx = 0
while xx <= 3000:
clicktheshit()
xx = xx + 1
time.sleep(.01)
clicktheshit()