Hi,
I am running an experiment that requires some rectangles to be placed strategically over the images. Each image is different and I may need to add more images in the future, so instead of going round and manually doing this to work out the rectangles position/size/orientation for each of the images, I wrote a program that allowed me to place the rectangles on the screen with a mouse. Once clicked, the program logs rect.height, rect.width, rect.ori, rect.pos into a text file that will be read in the main experiment to place such rectangles on a trial by trial basis.
i get/log these values to a text file by calling something like posX = rect.pos[0]
or width = rect.width
This is an example of the output:
img: Happy_face.jpg
X: -0.003125
Y: -0.08984375
Width: 0.3
Height: 0.2
Ori: (0,0)
Here is an example of my variable for shape.rect in the main program:
rectStim = visual.Rect(win, width=0.2, height=0.1,
opacity=1.0, fillColor='blue',
lineColor='white')
However, when I then try and use such coordinates to position each image in the main program:
rect.pos = [X, Y])
i get an following error:
Traceback (most recent call last):
File "ET_ASD_Mouse_v2.py", line 118, in <module>
eyeStim.height = thisTrial['eyeSizeH']
File "C:\Python27\lib\site-packages\psychopy\tools\attributetools.py", line 27, in __set__
newValue = self.func(obj, value)
File "C:\Python27\lib\site-packages\psychopy\visual\rect.py", line 77, in height
self._calcVertices()
File "C:\Python27\lib\site-packages\psychopy\visual\rect.py", line 47, in _calcVertices
self.vertices = numpy.array([(-self.width * .5, self.height * .5),
TypeError: can't multiply sequence by non-int of type 'float'
Do i need to convert the numbers that are being logged by the initial program (X: -0.003125, Y: -0.08984375) somehow before using rect.pos = (x, y)?
Any ideas?
Cheers,
Kris