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

    Status: Open => Answered

RaiMan proposed the following answer:
the sorted function accepts a so called lambda (anonymous function) as
sort key

key=lambda m: m.y * 10000 + m.x

where m represents a value of the given list. after the colon you have
to write down a formula, that returns ONE value.

Since in this case we want to sort with respect to 2 values (x and y),
we have to translate the sort value in some usable value.

In this case, we "shift" the y value to the left (*10000, should be sufficient 
for normal screen sizes) and add the x value.
This gives a combined integer, that does exactly what you want: 
grand order y value
local order (same y value) x value

-- 
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