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.

Categories

+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 (8 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 (302 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!

...