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

+5 votes

What is the difference between getAnchor() and getCenter()?

asked in CSC201 Spring 2021 by (8 points)

2 Answers

+3 votes
 
Best answer

Nothing really. For some reason our textbook author wrote a getCenter() method for Circles, but a getAnchor() method for Images and Text objects, even though it really does return the center point.

I thought it would be more uniform if EVERY shape had a getCenter() method, so I updated that when I created graphics2.py.

However, I didn't remove the getAnchor() method because I wanted to make sure all the book code/examples would still work with graphics2...

answered by (302 points)
selected by
+2

Would it be okay if we use getAnchor() method for every object or should we alternate between getCenter() and getAnchor() depending on the specific object type?

+2 votes

I was wondering the same thing. But when I look at it I believe that they are the same thing

answered by (8 points)
...