Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


+2 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 (385 points)

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 (2.6k points)
selected by

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!