← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #213457]: exists function not working after defining region

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
This is valid Python, but does not make any sense:

        CurrentBarRegion = Region(479,476,80,199)
        if CurrentBarRegion.exists:

--- CurrentBarRegion.exists
only returns the method object of the method exists, which is always true, since not null.

exists() always needs an image or a pattern to search for in the given
region CurrentBarRegion.

and CurrentBarRegion "exists" in that sense, that you just created a
Region object using Region(479,476,80,199), which is just a rectangle
somewhere on the screen, which does not know anything about its visual
content.

BTW: it seems, you are searching inside CurrentBarRegion, but
exists(Pattern("CurrentCycleStockHoverValue.png").similar(0.80)) searches the whole screen.

At this point I agree with j-the-k: for some reason the image
CurrentCycleStockHoverValue.png is not found in that moment.

this should be enough, to get nearer to the reason:

   def test_36VerifyCycleStockValueFromAllBar(self):
        CurrentBarRegion = Region(479,476,80,199)
        test = None
        if CurrentBarRegion.exists("CurrentCycleStockBarFromALL.png"):
            CurrentBarRegion.getLastMatch().highlight(2)
            test = exists(Pattern("CurrentCycleStockHoverValue.png").similar(0.80))
            if test: test.highlight(2)
        assert test # only for debug
#        assert (exists(Pattern("CurrentCycleStockHoverValue.png").similar(0.80)))

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