[Solved] Centering all the lines in a text statement
Posted: Wed May 06, 2020 8:05 am
Hi guys!
So I have objects in a class of which name I want to display in a text statement inside a screen, depending on which object is displayed, like this:
And I get this. Each text next to the correspondent item is what the code above is showing:

As you can see, the text is centered in each square. But now I want to make it so that the item.name's that takes two or more words are displayed in two lines. What I've done in the first place is add a \n to the attribute name for each item, like ("Studio\nmicrophone"). This is the outcome:

As you can see, the names are still centered. The problem is that it seems the statement text inside the screen doesn't seem to make a difference between words and it just renders the name of the item in two lines being the block of text centered instead of centering each line.
So how can I do it so each line is centered in the square?
So I have objects in a class of which name I want to display in a text statement inside a screen, depending on which object is displayed, like this:
Code: Select all
text "[item.name]" xpos xt+115 ypos yt+8 xanchor 0.5 size 15 font "BRLNSR.ttf" at girlsbuttons

As you can see, the text is centered in each square. But now I want to make it so that the item.name's that takes two or more words are displayed in two lines. What I've done in the first place is add a \n to the attribute name for each item, like ("Studio\nmicrophone"). This is the outcome:

As you can see, the names are still centered. The problem is that it seems the statement text inside the screen doesn't seem to make a difference between words and it just renders the name of the item in two lines being the block of text centered instead of centering each line.
So how can I do it so each line is centered in the square?