Psychopy version : 2021.2.3
(sorry for bad english)
I’m trying to create a feedback for my participants to see if they answered the task.
They see a stimulus (it’s an image file) displayed a fix amount of time, and they have to respond by pressing the key L or S (for yes or no). I would like that when they press one of the response key, the opacity of the image change.
So I create a variable ‘opacity’ that I put in the properties of my image and I need a code to detect if a key is pressed to change it. I checked on topics and find some codes but it did not work for me.
I’ve tried this :
In begin experiment :
opacity = 1
In begin routine
kb = keyboard.Keyboard()
In Each Frame
key_pressed = kb.getKeys(['s','l'], waitRelease=False, clear=False) if key_pressed : opacity = 0.5
I think my code does not detect if a key is press. Does someone have an idea of what code I should do instead ?
Thanks a lot !