← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #697117]: store captured image as variable into a py file

 

Question #697117 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/697117

    Status: Open => Answered

RaiMan proposed the following answer:
Uuuups, why so complicated:

img = "_someName.png"
capture(someRegion, img)

and you have your variable to do with it, whatever your want:

imgFilename = os.path.join(getBundlePath(), img)

a statement:
line = 'variable = "%s"' % imgFilename

... and now you could append this line to an images.py file using the
normal File-I/O

in turn you now can import this images.py using
from images.py import *

and you have your variable names available (even with absolute
filenames, so no imagepath needed)

... now the _ takes care, that your images are never deleted.

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