How can Psychopy show the content of each region?

Dear Friends,
Hi. I hope you are fine.

if you look at the region column, you will notice that Psychopy helps me to measure RTs for each region separately.

In fact, each cell of the region column shows me one region of each sentence.

Now, can we tell Psychopy to show the content of each region instead of (Head/Tail) or (Critical/Spillover)?

Thanks in advance

Personally I would recommend adding a column rather than replacing Region.

Add something like thisExp.addData('regionText',whatever code you have in the text component to display the region minus the dollar sign)

1 Like

Many thanks for your help.

If I am not mistaken, I should add the code component, thisExp.addData(‘regionText’,whatever code you have in the text component to display the region minus the dollar sign) in the Reading routine. Am I right?

I also added regionText column in my spreadsheet.

Would you please elaborate more on this?

You gave me the following code to display each region:
regions = Sentence.split(‘/’)
nRegions = len(regions)

Shall I enter this between the paratheses?

This is also my experiment file
Experiment.psyexp (36.6 KB)
stimuli_1.csv (229 Bytes)


Yes the code goes in the Reading routine

Don’t add regionText to your spreadsheet.




1 Like

Thank you

I wanted to use the code, but the following error appeared.

I am wondering if I did something wrong.

Delete and replace the apostrophes

1 Like

Thank you

The code works now.

I ran the experiment, but Psychopy wants me to define regionText. How can I define regionText?

Please show where you use regionText. I suspect you didn’t replace the apostrophes

I added the code component in the Reading routine like the following:

I also deleted the apostrophes between ‘regionText’ like the following:

Actually, I did not understand what you mean by replacing apostrophes.

Thank you for your time and consideration

regionText needs to have apostrophes around it, but you may have had “smart” ones which don’t work in code.


OK, thank you. Your help means a lot to me.

So, I guess we can’t show the content of each region in the auto-generated CSV file. Am I right?

thisExp.addData('regionText',regions[inner_loop.thisN]) should do it if I understand what you are trying to do

1 Like

It worked :pray: :clap:

You are my hero.

Thank you.