I want to know if is there a way to make multiprocessing working in this code. What should I change or if there exist other function in multiprocessing that will allow me to do that operation.
You can call the locateOnScreen('calc7key.png')
function to get the screen coordinates. The return value is a 4-integer tuple: (left, top, width, height)
.
I got error:
checkNumber1 = resourceBlankLightTemp[1]TypeError: 'Process' object does not support indexing
import pyautogui, time, os, logging, sys, random, copy
import multiprocessing as mpBLANK_DARK = os.path.join('images', 'blankDark.png')
BLANK_LIGHT = os.path.join('images', 'blankLight.png')def blankFirstDarkResourcesIconPosition():blankDarkIcon = pyautogui.locateOnScreen(BLANK_DARK)return blankDarkIcondef blankFirstLightResourcesIconPosition():blankLightIcon = pyautogui.locateOnScreen(BLANK_LIGHT)return blankLightIcondef getRegionOfResourceImage():global resourceIconRegionresourceBlankLightTemp = mp.Process(target = blankFirstLightResourcesIconPosition)resourceBlankDarkTemp = mp.Process(target = blankFirstDarkResourcesIconPosition)resourceBlankLightTemp.start()resourceBlankDarkTemp.start()if(resourceBlankLightTemp == None):checkNumber1 = 2000else:checkNumber1 = resourceBlankLightTemp[1]if(resourceBlankDarkTemp == None):checkNumber2 = 2000else:checkNumber2 = resourceBlankDarkTemp[1]