← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #263444]: How to compare 2 regions

 

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

aidma posted a new comment:
I don't have a solution, but I would like to point out a few things.

1. With regards to:

if tableRegion == tableRegion1:
    print "2 regions are similar!"

You are using the "==" operator here, which, as you've realized, does
not compare the visual contents of two regions. In fact, it doesn't even
compare the position and size of two regions. I don't know what the "=="
operator does with Regions, but it will probably only evaluate to True
if tableRegion and tableRegion1 reference the same object (i.e. not
different objects with identical attributes).

If you are really interested in comparing regions, try something like:

if str(tableRegion) == str(tableRegion1):
    print "The regions share similar attributes!"

But I don't think that's what you want to do.

2. Remember that regions know nothing about their visual content, only
their position on the screen and their dimensions. Read here for more:
http://doc.sikuli.org/region.html#Region.onAppear

3. Maybe "observing for visual events in a region" will help you out?
http://doc.sikuli.org/region.html#observingvisualeventsinaregion

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