sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #31856
Re: [Question #265514]: List, object has no attribute 'hasNext'
Question #265514 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/265514
Status: Open => Solved
Maks confirmed that the question is solved:
Thanks Eugene S and RaiMan for help.
All is simpler than it seems.
As I iterate LIST it has no hasNext() attribute, but it has len() function. That's enough to check len() does not equal "1" and do not click() this time.
Working code:
def order(match):
return match.y, match.x
def CLICKER():
scr1 = Screen(1) #or Screen(0) for default monitor
pat = Pattern("1429549493296.png").similar(0.95) # this is plus "+" image
sorted_icons = sorted(list(scr1.findAll(pat)), key=order)
for icon in sorted_icons:
if len(sorted_icons) != 1:
click(icon)
CLICKER()
break
CLICKER()
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.