sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #51043
Re: [Question #679317]: organising images and functions in different scripts in sikuli
Question #679317 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/679317
Status: Open => Answered
RaiMan proposed the following answer:
--- instead of this
imagePath="C:\Tools\Images"
sys.path.append(imagePath)
import Images
reload(Images)
use just
imagePath="C:\Tools\Images"
addImagePath(imagePath)
since you do not need an empty .py on sys.path.
--- instaed of
UI={}
UI ["icon"]=" shortcut icon.png"
use just
icon =" shortcut icon.png"
BTW: you can simplify the whole thing, if you just put the assignments
into the images.py in images.sikuli.
then the first script would not be needed and in the second
instead of
from UI_Images import*
reload(UI_Images)
just use (sys.path eventually adjusted)
from images import*
reload(images)
The IDE has a feature for that:
put
img1 =
on a line and press the capture button, and you will finally get:
img1 = "img1.png"
just implement your image naming convention at the variable side and you
are there.
--- One more thing:
if you import other .sikuli from the same folder, then you do not need:
Path = os.path.dirname(getBundlePath())
if not Path in sys.path: sys.path.append(Path)
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.