Mac OS, latest PsychoPY
What are you trying to achieve?:
I am displaying one image/trial for a memory task; many of the images are different dimensions. My conditions file has two columns, xdim and ydim, that specify the width and height in pixels, respectively. I need to set the image component each repeat to use these dimensions.
What did you try to make it work?:
I tried creating a code component at the beginning of the “image” routine:
img_size = [xdim, ydim]
and then I set the image component size to $img_size
What specifically went wrong when you tried that?:
Unfortunately, this technique places the code from that component after img_stim.setSize(img_size)
In other words, the script is trying to set the size to img_size before img_size has been defined. Now, it’s easy (and it works) to simply compile the script and move the xdim, ydim line to above the setSize line. However, I like to have the flexibility to work mostly in builder, so it’s easier to make changes and not have to go back and forth between builder and coder. So my question is: is there a way to ensure that this line of code (which has to be repeated for each iteration of the loop) to be placed before setSize?
Thanks!