I have many instructions for the experiment I am currently working on.
I wanted to present them all in one text component and therefore made a Loop around my text component with the following conditions-file:
Later I wanted to add more Text for Instr1 and Instr2 but currently I am already struggling with displaying the both texts beneath each other. I tried to do it this way:
unfortunately this does not work. I hope someone has an idea!
I am trying it this way, because I wanted to reduce the amount of text-components from 10 to 1 with a loop.
OS (Win10): PsychoPy version (e.g. 1.90.1):
**Standard Standalone
Hello. In Builder, there is often a lot of confusion about the the $ symbol represents. It doesnât mean âthis is a variable nameâ. It means âInterpret what follows as valid Python syntax rather than literal textâ. So you can combine variables, operate on them with Python functions, and do pretty much anything you want. For example, one of the simplest way to combine strings of characters in Python is simply to add one to another. In your case:
$Instr1 + '\n' + Instr2
(Notice there is just one $ required, at the beginning of the expression).
Here, \n is a special escape sequence, indicating a new line character.
Unfortunately no. Text stimuli are currently limited to a single font setting for all their content. To get this effect, you would need to create two separate text stimuli, with different font sizes applied to each as required.
Hi Michael,
I have the same problem but I couldnât solve it the way you suggested. I want to show some values in a routine, so I opened a text box and typed my two variables with the formula $Instr1 + â\nâ + Instr2 (with my variable names). If I use this I get a âTypeError: must be str, not intâ error and experiment donât run. If I only use one variable, the experiment runs but instead of showing the values of the variable, it shows the variable name without the $ icon.
I have the variable and the data in the condition file that I put in the big loop. Iâm not sure what Iâm doing wrong.
Also, I wonder if itâs possible to use both text and variables in the same text stimuli. So if I want to present the same text with different values in each trial, can I do something like this: Example sentence $variable exampleâŚ
If I write this it gives a syntax error, so is there a way to combine these two?
Hi, the error suggest that one of your variables is interpreted as an integer. Putting str() around this variable will likely fix that. For your second question, you can simply say $âexample sentenceâ + variable + âend of example.â.