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

nospam.Vincent Vande Vyvre vincent.vande.vyvre at telenet.be
Sat Nov 25 17:34:00 EST 2017


Le 26/11/17 Ä  10:09, Greg Tibbet a ÄCcritâ :
> 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)

Hi,

It's not defined in Python module but in
Pillow-3.5/Pillow-master/libImaging/Draw.c

... line 748


Vincent




More information about the Python-list mailing list