OS Mac 10.13.6
PsychoPy version v2020.1.2
Standard Standalone? (y/n) yes?
What are you trying to achieve?:
Get a polygon object to disappear with a mouse click, but not end the trial.
Specifically, I am a newish user trying to create a two-alternative forced-choice recognition memory task in the Builder.
Target and distractor words appear to the left and right of the center of the screen, and the trial should end with a keypress (when the participant presses f to identify the stimulus on the left as the target or j to identify the stimulus on the right as the target.)
My goal:
The trick of my test phase is that, at the onset of each trial, one of the alternatives (target or distractor, left or right) should covered by a rectangle set at opacity = 1. If the participant wants to see the second alternative, then they have to click the rectangle covering it with their mouse.
A mouse click on the rectangle should trigger a change the opacity of the rectangle to 0, so that the participant can see the second word.
The participant does not have to click to box to see the second test item, and can end the trial with a keypress identifying the already-visible item, if they want. So the mouse click should be optional and not end the trial, but if the participant does click the rectangle, then the second word should show up.
What did you try to make it work?:
Current state:
Currently, I have the simple routine with words from a condition list that appear on the left and right, and trials that end with a keypress. That all works fine. Eventually I will need to set up counterbalancing, but am not quite there yet.
I am having trouble getting the rectangle to disappear with the mouse click. Based on this post: Clickable stimuli, draw rectangle - #4 by Julia.fr
I think that my issue is best solved with a code component, (like my current attempt below) but the rectangle never disappears.
Here is what is in my code component:
if mouse.isPressedIn(polygon1) :
opacity = 0
What specifically went wrong when you tried that?:
The rectangle doesn’t disappear. Trial ends with fine with keypress, but never reveals the second word. Photos below show settings for mouse and the components in the routine.