I have two questions about text formatting.
How can you center the text within a textbox stimuli? Similar to what the normal text stimuli does by default. I’ve tried adding
textbox.alignment = 'center' in code component, without luck.
How can you make normal text stimuli in italic? Here I’ve tried setting
text.italic = True in a code component. I saw some documentation about setting the font as an italic, but I do not know the exact name of the italic font for Open Sans.
Thanks in advance.
I am not sure about your questions, but I suggest to present formatted text using an image (e.g. create a powerpoint slide and format your text there, than take a capture of your screen) instead of a textbox component.
Thank you for your answer, but unfortunately I’m reading a lot of data from an Excel sheet and using the variables as text stimuli.
It would be a lot of unnecessary work for this particular experiment…
Are you wanting the participant to edit the text in the textbox?
Are you wanting a whole block of text to be in italics or just some of the words?
Just visual stimuli and no editing. The whole component is meant to be in italic, yes.
With the textbox I get italics, but left alignment. And with normal text stimuli I get no italics, but center alignment. I want center alignment and italics, both with and without a textbox border for different components.
I’ve just been playing about with code such as:
text.fontFiles = [‘OpenSans-Italic.ttf’] # load file(s)
text.font=‘OpenSans-Italic’ # set to font
text.italic = True
with no success despite the documentation.
Have a go at creating the textStim in code and add the parameter italic=True at the point of creation.