Question about tolerance changing via script

Asked by Don S on 2018-07-02

I'm trying to find an image using tolerance so that I can click it and know that it was clicked properly. My code right now is

if exists("GaffeUnselected%d" %(game_number)):
    print("Button has not been pressed")
click("GaffeUnselected%d" %(game_number))
if exists("GaffeUnselected%d" %(game_number)):
    print("Button has not been pressed")
elif exists("GaffeSelected%d" %(game_number)):
    print("Button has been pressed")

I want the tolerance to be 96 or .96 for these images, but wherever I add that (either via .similar(.96) or exact(96) I get an error and it isn't running properly. I'm a beginner to Python, so any code examples for this would be much appreciated ^__^

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
Don S
Solved:
2018-07-18
Last query:
2018-07-18
Last reply:
2018-07-02
masuo (masuo-ohara) said : #1

Use SikuliX IDE and click image in editer pane, pattern setting window open.
Then select matching preview tab and move slider to change minimum similarity.
Switch off [Show ThumbNails], pattern setting will be shown.

like this:
click(Pattern("1530562928013.png").similar(0.96))

Don S (toonroxas) said : #2

Thanks for the help!!