Clickable words on a tex/textbox obj

PsychoPy version 2023.2.3
Standard Standalone

let’s consider that we have this paragraph:

“Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.”

I want to display this paragraph as a text or textbox object. then I have a mouse object to find out what words the user has clicked on them.

I want to show the text to user and tell them click on every words the want in the paragraph.
At the end I want to have the words each user has clicked on them.

can I design this task in PsychoPy?

In “Dictation Sentences” I used a monospace font so I could calculate the position of the mouse relative to the words to allow natural editing:

The alternative would be to use a separate text object for each word (easy enough if you use an array in a code component). This would allow you to, for example, change the colour of selected words.

Thanks wakecarter. Actually I want the alternative way because I need every time a word is clicked it becomes red and if it’s clicked again it becomes black again.

Would you please show me how in Code Object in PsychoPy Builder I can create 400 text objects and config them with name (w1 to w400), size, position and color?