psychopy.org | Reference | Downloads | Github

What does wrapWidth actually do?

Dear,

I show words one by one on a screen which participants have to read out loud.
Words need to be shown at just one line in a window:

window = visual.Window(fullscr=True, allowGUI=False, allowStencil=False, monitor=‘hp’,
screen=1, color=[1,1,1], colorSpace=‘rgb’, units=‘pix’)

My monitor’s resolution is 1152*864.
However, if words are too long some letters are shown on the line beneath, so a word is shown at two lines here.
For example:

#good
dangerously
#not good
dangerous
ly

Words are defined like this:

text = visual.TextStim(
win=window,
text=padded_syllable, font=‘Courier New’, color=colors[color_index], colorSpace=‘rgb’,
units=‘pix’, pos=( 0, -234 ),height =68,
)

When I add wrapWidth to this, then the whole word is shown at one line on my monitor.

text = visual.TextStim(
win=window,
text=padded_syllable, font=‘Courier New’, color=colors[color_index], colorSpace=‘rgb’,
units=‘pix’, pos=( 0, -234 ),height =68, wrapWidth=500
)

However, what does wrapWidth actually do?

Best,
Koen

It determines the width at which the line will wrap to the next. If your word needs more than 500 pixels to render then it will wrap again!

1 Like