← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #671266]: creating an image lib

 

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

RaiMan proposed the following answer:
--- I tried to figure out for view hours how this works

... rather simple:

- make a script somewhere and name it e.g. MyImages.sikuli

- use the IDE, to capture and name the images

- save the script

- in your script simply say at the beginning:
setBundlePath(<absolute path to your MyImages.sikuli>)

**** For automatic naming of images there is a nice goody in the IDE:

- make line like so
image1 = 

- place the cursor somewhere at the end of the line after the =

- take a shot

the shot will be named image1.png and will keep the same name when
recaptured

then there are 2 usage scenarios:

1. image path
- use setBundlePath()
- reference the images as Strings like 
find("image1")

2. import
from MyImages.sikuli import *
find(image1) # ref using the assigned variable.
... be careful with possible name clashes - have a naming convention.

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