acircle.getCenter() to (x,y) coordinates in Python

MRAB python at mrabarnett.plus.com
Mon Dec 25 13:31:26 EST 2017


On 2017-12-25 02:42, G Yu wrote:
> Ah, I get it now.  I have to store the acircle.getCenter() in a point Point, and then access Point.getX() and Point.getY() separately.  It was just that middle step that I was missing.  Thanks so much!
> 
It's not strictly true that you _have to_ store the result of 
acircle.getCenter().

You could call it twice:

     (acircle.getCenter().getX(), acircle.getCenter().getY())

or you could write a function for it:

     def as_cartesian(point):
         return point.getX(), point.getY()

and call it:

     as_cartesian(acircle.getCenter())

Just pick whatever way makes the most sense.



More information about the Python-list mailing list