sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #29816
Re: [Question #259550]: issue in comparing two images
Question #259550 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/259550
Eugene Maslov proposed the following answer:
Raimund, I meant above that I heard that something in Java can deal with exact colors. I just didn't know that jRobot is accessible from Python.
So now I solved my problem with pressed/released buttons, measuring the color inside the glyphs with jRobot.
import java.awt.Robot as jRobot
import java.awt.Color as Color
def findWithColor(img, reg=SCREEN, color=Color(255,255,255), probe=[0,0], debug=False):
myRobot=jRobot()
res=None
reg.findAll(img)
found=list(reg.getLastMatches())
for but in found:
probePoint=but.getCenter().offset(probe[0],probe[1])
myColor=myRobot.getPixelColor(probePoint.x, probePoint.y)
if debug:
print "color at "+str(probePoint.x)+":" +str(probePoint.y)+":",myColor
if myColor==color:
res=but
if not debug:
break
return(res)
Settings.MinSimilarity=0.85
#Stable click on grayed button:
findWithColor("unpressed.png",color=Color(204,219,233), probe=[2,2], debug=True).click()
#Stable click on white button
findWithColor("unpressed.png",color=Color(255,255,255)).click()
Thank you very much for the suggestions.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.