I presume this is a n00b issue, but I’m lost nonetheless.
Within each iteration of a certain routine, I am trying to check whether a drag&droppable stimulus (DDstim) is intersecting another stimulus. However, the stimulus to be intersected (i.e., not DDstim) differs for each iteration, and the name of the correct stimulus object is contained within a variable (OverlapCorrect). Thus, my aim was to call the name of the object to be intersected and use it as a parameter in DDstim.overlaps() within a condition, like so: (let’s assume the actual name of the object to be intersected was “ObjectA” in this case)
if DDstim.overlaps(thisTrial.OverlapCorrect): …
however, I’m getting an error:
pyo version 0.8.0 (uses single precision)
Traceback (most recent call last):
File “…”, line 574, in
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.2-py2.7.egg\psychopy\visual\basevisual.py”, line 583, in overlaps
return polygonsOverlap(self, polygon)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.2-py2.7.egg\psychopy\visual\helpers.py”, line 104, in polygonsOverlap
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\matplotlib\path.py”, line 512, in contains_points
result = _path.points_in_path(points, radius, self, transform)
ValueError: could not convert string to float: ObjectA
…not sure why I’m getting this kind of error, since when I hardcoded this instead, like so:
if DDstim.overlaps(ObjectA): …
the code works as intended. I’m probably missing something regarding the connection between what is read as a string from the conditions file and the object the name of which is identical to this string.
Thanks for help!