← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #286623]: Using A list of regions Sikuli crashes ?

 

Question #286623 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/286623

Description changed to:
Hello ,
i have run into a problem when using lists in sikuli.
i have 8 regions in  a list and the code is supposed to run through this list checking for a match, In this case its "img"
if the match has been found it returns 5 ,if not 10 and it is supposed to sort it .The final part would be to highlight the regions without the match .
But every time i click run the code Sikuli just disappears with no errors or any warning .Any idea whats wrong with my code ?
Code :
ListR = [(Region1),(Region2),(Region3),(Region4),(Region5),(Region6),(Region7),(Region8)]
img =Pattern("img.png").similar(0.67)
# Sort key function
def crosscheck(img):
    for x in range(0, 8):
        y = ListR[x]
        if y.find(img):       
            return 5 
        else:       
            return 10
# Main function
while exists("loopImage.png"):
    sortedMatches = sorted(ListR, key=crosscheck)    
    ListR[5].highlight(1)
    ListR[6].highlight(1)
    ListR[7].highlight(1)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.