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

    Status: Open => Answered

Tsung-Hsiang Chang proposed the following answer:
Suppose your question is ordered by from top to bottom, you need to sort the 
matches by their y coordinates.
Here is a sample code that shows to how to do this.
 
---
def by_y(match):
    return match.y

icons = findAll( [ANY_IMAGE] )
sorted_icons = sorted(icons, key=by_y) # sort the icons by their y coordinates 
and put them into a new variable sorted_icons
print sorted_icons 

---
A shorter version is using lambda.
icons = findAll( [ANY_IMAGE] )
sorted_icons = sorted(icons, key=lambda m:m.y)

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

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to