Hi,
I’m trying to create a word association experiment, wherein participants have to respond to a stimulus word with any words which enter their mind in response to the stimulus presented, until the stimulus disappears after 60 seconds.
With the help of some forum members, I’ve got to a point where the experiment basically works - participants can enter the words they think of, see them on screen, and modify them. The words then they get sent to a data file. However, I’d really like two additional things to happen. The main code for doing the above is in the “each frame” section:
keys = event.getKeys()
if len(keys):
if 'space' in keys:
text.text = text.text + ' '
elif 'backspace' in keys:
text.text = text.text[:-1]
elif 'lshift' in keys or 'rshift' in keys:
modify = True
elif 'escape' in keys:
core.quit()
elif 'return' in keys:
text.text = text.text + '\n'
else:
if modify:
text.text = text.text + keys[0].upper()
modify = False
else:
text.text = text.text + keys[0]
and the following in “end routine”:
thisExp.addData("typedWord", text.text)
However, this results in a line-separated string of responses being placed into a single column, “typedWord”. This isn’t ideal because it leaves me needing to post-process those responses by moving each response into its own column (i.e. columns named "response_1, response_2, etc.). So my two questions. Firstly, is their any way to have Psychopy create a new data column for each response entered? So that if my participant types “hope [return] glory [return]” (up to a theoretically unlimited number of responses), I get a csv file with a column “Response_1” with “hope”, and “Response_2” with “glory”?
And secondly, I’d like each response to disappear once typed (and sent to its unique column), so that participants are discouraged from responding not to the stimulus but to their own previous response (i.e. chaining). I’ve tried this using:
elif 'return' in keys:
text.text = ' '
This has the desired effect on screen, but unfortunately it also results in only the last response to each stimulus being sent to the data file.
Many thanks,
Peter
Win10
PsychoPy 3.1.5
cond.xlsx (8.1 KB) 2019 WA practice file.psyexp (13.0 KB)