I have two issues that I’m having trouble figuring out in builder code. ( Am new to psychopy).
I would like the participant feedback to be visible when they are keying it in. Is this possible?
The participant will be keying in two letters and then hitting spacebar to go to next trial. I know how to “force end trial” if they are only responding with one keypress, but am not sure how to record the two key presses without forcing the end of trial.
If you could help with either or both, it would be much appreciated We are scheduled to start running participants early next week so I’m in a bit of a time crunch.
For custom requirements like this, you really need to be capturing the keypresses in code rather than using a keyboard component: it doesn’t have the flexibility you need. So
(1) Delete your keyboard component (it would conflict with dealing with keypresses in code).
(2) Insert a code component. In the Begin routine tab, put something like this:
feedback = '' # initialise to an empty string
(3) In the Each frame tab, put something like this:
keypress = event.getKeys() # check the keyboard
if keypress: # if the list contains a value
# extract the first element:
keypress = keypress[0]
if keypress == 'space':
thisExp.addData('response', feedback) # save in the data
continueRoutine = False
elif len(feedback) <= 1: # only display up to 2 letters
feedback = feedback + keypress
(4) Shift your text component so that it is below the code component (so it can access the latest value of feedback). In its text field, put this: