Underline a word in a stimulus

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): win10
PsychoPy version (e.g. 1.84.x): v2022.2.4

What are you trying to achieve?:
I have sentences like: “flolp: There is a flolp.”. This is using pseudowords. I want to underline the “flolp” in sentences. Right now, I have several sentences in a column in an excel file and it is pulling the sentence and displaying it just fine. However, I cannot get the word to be underlined.

Right now it looks like this: flolp: There is a flolp.
I want it to look like this: flolp: There is a flolp.

What did you try to make it work?:
I tried to put \u0331 in the excel column, but that did’t work.
i tried to just underline it in excel and that didn’t transfer.

Is there a way to put a string of javascript or python in the excel column that will format this correctly?

Do I need to put the code in the psychpy more directly? If so, that is a little tough becuase I would have to split the sentence into parts in the excel but I guess that is not the end of the world. It would look something like

$sentp1 + ‘\u0332’.join(‘Sentp2’)+‘\u0332’ + sentp3

where:
sentp1 = flolp: There is a
sentp2 = flolp
senpt3 = EMPTY but in some examples there are words after the psedoword

I am kind of a beginner with all this, so any advice would be appreciated!

Hi all,

I kind of figured it out. I ended up putting a column called mctester4.

in the textbox i put $eval(mctester4) and in each cell in that column it had something:

“flolp: There is a f\u0332l\u0332o\u0332l\u0332p\u0332.”

This worked but it isn’t flawless. It is coding each letter individually as underlined and a large letter like w ends up having some space on the side which isnt perfect, but it’ll do.

If anyone has a more elegant solution, please let me know.

I think that what you’ve done is probably the best solution.

An alternative would be to use embedded html. You could send the item as a parameter and then have html of the form <p>x: There is a <u>x</u></p>.

Have a look at my online demos (e.g. Brookes Template 2020) for more information about embedded html