Argh!! Can't wrap my head around this Python stuff!

Greg Tibbet gtibbet27 at msn.com
Sun Nov 26 04:09:55 EST 2017


I'm an old timer, have programmed in Fortran, C, C++, Perl, and a bit
of Java and trying to learn this new-fangled Python language!

I've got a small program that uses PIL to create an image, draw some
primitives (rectanges, ellipses, etc...) and save it.  Works fine...
no issues.

I've found in the past, the best way to "really learn" the language
was to "dig into the guts" and understand it,.. I thought I was making
progress, but when looking into the PIL library to see what's going on
behind the scenes, I find the following code in ImageDraw.py

def ellipse(self, xy, fill=None, outline=None):
        """Draw an ellipse."""
        ink, fill = self._getink(outline, fill)
        if fill is not None:
            self.draw.draw_ellipse(xy, fill, 1)
<...snipped...>

ellipse() uses the method  self.draw.draw_ellipse()   Okay, fine...
but WHERE is draw_ellipse defined??  What magic is happening there?
I've searched the entire PIL directory tree, and the ONLY two places
draw_ellipse is mentioned are right there in the ellipse() function...
WHAT am I missing??  

Thanks!
-Stumpy (aka Greg)



More information about the Python-list mailing list