← Back to team overview

sikuli-driver team mailing list archive

[Question #817896]: OnAppear Observer Error with Pattern.resize()

 

New question #817896 on SikuliX:
https://answers.launchpad.net/sikuli/+question/817896

I have something along the lines of the below code. When scale is 1, the code runs as expected. When scale is less than 1, I get an error along the lines of "the image to search for [100,100] is larger than the image to search in [75, 75]." Of course, I don't want to search for an image that is 100x100; I want to search for the scale (0.75) version of the 100x100 image. And yes, the error's dimensions given for the image to each *in* are the scaled dimensions per the scale variable.

scale = 0.75
img = "someimage.png"
# Note: img is 100x100

if scale != 1:
    img = Pattern(img ).resize()

doBreak = [False]

def appearHandler():
    #some code
    doBreak [0] = True
    pass

region.onAppear(img, appearHandler)
region.observeInBackground(60)

while not doBreak [0]:
    #some code
    wait(1)

region.stopObserver()
Observing.removeRunningObserver(region)
Observing.remove(region)


-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.