Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+3 votes

I have a bunch of text objects below one another, and I'm trying to get their left edges to line up. Unfortunately, they are all of slightly different lengths, and because I generate them in a for loop and the "point" used by text objects is a center point, rather than a corner point, I can't get them to line up. Anyone have any ideas on how to get them to line up?

asked in CSC201 Spring 2021 by (1 point)

1 Answer

0 votes
 
Best answer

Yeah, hmm. Not as easy as it should be.

Maybe try using the "Courier" fixed-width font and make all the strings the same length (using f-strings and field width specifiers).

In my future graphics3.py, I should maybe figure out a way specify a way to left or right justify the text in a Text object.

answered by (5.7k points)
selected by
0

Using Courier worked! I was slightly mistaken in that the text objects were, in fact, the same length. It was the varying width of the characters messing things up. Thank you Dr. Stonedahl!

...