Python style Dictionary, string as key
This is how i got a normal python dictionary to work with Sikuli.
1) make and image library. i have created my like this:
from sikuli.Sikuli import *
ItemToBeClicked = 12345543.png # aka the screen shot
2) create your main script that imports the images
from imageLib import *
class mytest():
__def __init__(self):
____self.myValues = { 'clickthis'
____self.answer = None
__def whatToclick(self):
____self.
____click(
mt = mytest()
mt.whatToclick()
in short VDict is great for working with that image as your key. but if you want to work the other way/direction it's a bit harder. The why I'm showing allows a user to use a string as your key and and image variable as you value.
i don't hard code my path to image files because that reduces code re-usability(if that's a word... lol) and if i have to change screen resolutions then i have a separate file that allows easy of retaking pictures at a new resolution.
i'm posting this to show other users how to achieve this and to have it looked over to see if the code is correct in procedure.
let me know if there are any problems with my method of handling this.
thanks
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply: