Changing background color of a canvas by referring to a variable
in OpenSesame
Hi Everyone,
I am building an experiment in which I am trying to change the colour of canvas background by referring to a variable 'color' that I created so my canvas can have different colors (yellow and blue in this case) in each trial. This is the function that I use to refer to the variable:
cv = canvas(background_color='var.color')
However, this does not work and I always get en error. Does someone maybe know how to correct this and write the code so that the canvas color can be determined by the variable I created?
Thank you very much for your help!
Comments
Hi,
In Python, if you put something between quotes, it becomes a string of characters. In your case, that's not what you want, because the color is not literally the text 'var.color', but rather the value of the variable
var.color. Do you see that conceptual difference? If not, I would recommend first going through a basic Python tutorial (to avoid yourself a lot of frustration):So in your case, what you want to do is:
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Thanks!