← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #251515]: sikuli doesn't recognize an image on list in a loop

 

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

RaiMan proposed the following answer:
Not complex for you might be, but for someone else looking at 3 nested
loops, that do not have the ending condition in the head and having to
live with a poor naming and no comments it is indeed complex.

But anyway:
when you leave the second loop the first time this will be newly evaluated in the second turn:
region1.findAll(image.menu)

which will give you a completely new set of match objects.
Since you are saving objects in your containers, using:
if menu==list_menu[itt]:

will always end up in false, since the objects are not the same objects.

You need some equality evaluation like that:
def matchEquals(m1, m2):
  return m1.x == m2.x and m1.y == m2.y

if matchEquals(menu, list_menu[itt]):

BTW: this has surely nothing to do with Sikuli, but is a basic Python
knowledge ;-)

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.