Am i able to use the $w,$h as input to Size of a image stimuli in a routine? Apparently it only takes scalar values such as (1.8, 1), but not ($w, $h)
OS (e.g. Win10): mac sierra 10.12.4 PsychoPy version (e.g. 1.84.x): v2020.2.3 Standard Standalone? (y/n) No
The error i get is : Looks like your variable ‘(w,h)’ in ‘Size [w,h]’ should be set to update.
There is no update option.
Is there a way to get the gui to evaluate the expression as of w and h are variables instead of expecting scalars? I am well versed in python and JS but I am not familiar with the GUI-specific syntax that is required in builder. Am i missing something?
If there is no update option try adding a code component and in the begin routine tab use something like:
image.size = [w, h]
You should be able to leave the size dimensions of your image as default since they should be overwritten by your image.size code anyway.
Let us know how you get on,
Becca
[image should be substituted with the name of your image component]
I have posted an example. I would like to use the w and h as a variable to scale with right within the gui. Somehow, this functionality is missing in the builder. I can use scalars like (2,3) but not variables I can evaluate on the fly.
Try removing your dollar symbols. Dollars indicate that python code is going to be used in that field (it doesn’t indicate a variable) and only needs to be used in fields that don’t have a dollar symbol in the field name by default
Becca
Thank you for your reply. Unfortunately, neither options will work. The reason is that that tuple is passed to ImageStim’s constructor and it requires size=(val1,val2). w and h are not in scope when the call is made. Unfortunately, I have to dig around or find a different way.
if you are editing using code in the parameter field (as in your image there) you might also want to have the field set to ‘set every repeat’ rather than ‘constant’