| Reference | Downloads | Github

Printing keyboard responses on screen - cannot complete the code


Dear all,

I am quite new to PsychoPy and I would appreciate any help here. My experiment involves series of events and for each event I need the participant to provide a 2 digit response. This response forces the routine to end. I am trying to edit the code so that participants can see what they are typing in real time. I don’t want them to have to press enter to accept the response, As the code is set up at the moment the routine terminates after a 2 digit press. I would like to keep it that way but simply allow participants to see what they are typing (the routine can end in the next frame, after one screen refresh if possible). Any help here would be appreciated greatly.

The stimuli I have are:
EventList - the event text (text stimuli)
BR - Text prompting participants to give a response
key_resp_1 - response in digits. The component allows only digits, duration is set at 6s as the experiment has a time limit. Stores all responses, and 2 digits force the end of the routine.
code - code on ensuring that the responses are recorded only as a 2 digit response (a 2 digit press ends the routine)
code_6 - trying to get this bit to update to reflect what participants are typing (screenshot below, I tried to adapt the code based on what I have seen on the forum). In the Begin Experiment tab I have written simply msg=’’
AnswerDisplay - the text stimuli that prints the response (screenshot below). As a text I have provided $msg which resets every repeat. This component is also limited to 6s.



As a first step, this needs to be set to update on every frame, so that it refreshes in real time.