Difference between using VDict and dict?

Asked by Raymond

Sorry if this is a newbie question, but the documentation was a little unclear to me. What exactly is the advantage of using a VDict over a regular dictionary. Currently I'm using dictionaries with image filepath as a string for values. What would be different if I used VDict?

Question information

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

In a VDict, the keys are images and there are some methods, that look for a matching key using the image find features.

so if you say (supposing vd is a VDict containing some entries):

val = vd["path-to-an-image"]

you will get the value of the entry, that matches best to the given key image represented by "path-to-an-image".

Your question:
A dictionary with the image path's as keys finds an entry by matching strings. A VDict finds entries by matching images.
In your case, you would have the risk, that you do not get the entry you are looking for, because a similar entry is found with a higher score.

Can you help with this problem?

Provide an answer of your own, or ask Raymond for more information if necessary.

To post a message you must log in.