VDict() broken on Mac?

Asked by xavier

Hi,

My environment:

OSX Maverick
Java 1.7.0_51_b13

On both Sikuli.IDE. 1.0.1 & sikuli.script.jar, I get the following error when initialising a = VDict() (other sikuli APIs are working fine)

[error] NameError ( name 'VDict' is not defined )

The command works fine on my previous sikuli version 903.

Is VDict() deprecated? or my syntax is wrong? or are there extra steps in the installation process? Anyway, I did a quick comparison between the 2 jars and found that VDict.py can no longer be found in version 1.01.

Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Sorry, but VDict is no longer available.

What is your use case?

Revision history for this message
RaiMan (raimund-hocke) said :
#2

The reason:
It was a Python only implementation and it did not really make sense.

Revision history for this message
xavier (xavier-tay) said :
#3

I use Listener to monitor specific region for changes (region.onChange and region.observe) in the background, any change in the region will trigger an event where a snapshot is taken and compared to a list of predefined images (VDict) to determine what was changed.

Is there another way around this without using VDict?

Thanks.

Revision history for this message
Best RaiMan (raimund-hocke) said :
#4

Ok, interesting approach and usage of VDict.

images = [... some listed images ...]

changed = capture(changedRegion)
finderChanged = Finder(changed)
nImg = -1
for img in images:
    nImg += 1
    finderChanged.find(img)
    if finderChanged.hasNext(): break

# nImg contains the number of the image in the list

You might do it similar with a dictionary and finally get the matched images key, go go on with.

With this solution the listed images must be smaller (contained in the captured region) than the changedRegion.

Revision history for this message
xavier (xavier-tay) said :
#5

Thanks RaiMan, that solved my question.