| Reference | Downloads | Github

Displaying text stims with variable values: alignment

Hello All,

How can I display two, variable-derived text stimuli, one under the other on the screen?

For example:


My problem: I am trying to display 2 text stimuli. I’d like one to appear under the other, a couple lines down. When I do this with regular text stimuli (that is, just displaying some non-changing, written message like “FirstLine” / "SecondLine), this works fine.

50 PM

However, when I attempt to achieve the same thing with text defined by passed-in variables (like, putting $stimuli in the Text field instead of “FirstLine”), I run into issues. It displays the message. However, if there are more than one variable-determined stimuli, they show up overlapping, even if I enter the same way as I did for the regular text stimuli.
25 PM

I went to coder, and noticed that the “SecondLine” stim was represented like this:

… text_2 = visual.TextStim(win=win, name=‘text_2’,
text=u’\n\nSecondLine\n’, …

The variable stim was like this:

… ExampleProb = visual.TextStim(win=win, name=‘ExampleProb’,
text=‘default text’, …

However, trying to do the following didn’t fix:

… DisplayTheTyping = visual.TextStim(win=win, name=‘ExampleProb’,
text=u’\n\ndefault text\n’, …

Any advice appreciated! Thanks.

Use the position field for this purpose.

Got it! Thanks for clarifying.

(For anyone who may be fumbling through this like me: the increments on position are very small: if you use 0,10 nothing will show up, but something less than one like 0,.4 works.)

That depends on what units you specify: