how to identify a picture inside a region

Asked by Marc Summers

 If I have code like this:

   sbuttons = list(findAll("selectcoverage.png"))
    print "I Found ", len(sbuttons), " sbuttons matches"
    sbuttsorted = sorted(sbuttons, key=lambda m: m.y)

    k = sbuttsorted[0]
    r = Region(k.getX(), k.getY(), k.getW(), k.getH())

is there some way to identify the actual picture that
is inside the Region.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Marc Summers (2aircraft) said :
#1

Well, that probably did not come out the way I wanted it to.
So let's say that if I have this code:

  k = sbuttsorted[0]
    r = Region(k.getX(), k.getY(), k.getW(), k.getH())

Can I identify the picture that is in a specific Region.

such as

r = Region(418, 686, 100, 14)

and also how would I actually write the syntax
for such a Region, I know that I can not use actual integers

Revision history for this message
Marc Summers (2aircraft) said :
#2

   Another way to ask this would be, if I have this code

    tbuttons = list(findAll("serialnumber.png"))
    print "I Found ", len(tbuttons), " matches"
    tbuttsorted = sorted(tbuttons, key=lambda m:m.y)

    hover(tbuttsorted[3])
    mouseMove(-129, 40) <<< then how do I tell what picture is at this position ?

Revision history for this message
RaiMan (raimund-hocke) said :
#3

tbuttsorted is a list of Match objects, which in turn are a subclass of Region.

so you can ask:
someRegion.contains(someMatch)

which returns True if the Match-Rectangle completely lies inside the Region rectangle.

Can you help with this problem?

Provide an answer of your own, or ask Marc Summers for more information if necessary.

To post a message you must log in.