PIL Example

Fredrik Lundh fredrik at effbot.org
Wed Jan 24 02:27:23 EST 2001


smibr at my-deja.com wrote:
> Current code looks like this:
...
> draw = ImageDraw.Draw(im)
> draw.line((0,0),im.size, fill=128)
> draw.line((0,im.size[1]),(im.size[0],0), fill=128)
> del draw
...

That's not the same code as you posted before:

> draw.line((0, 0) + im.size, fill=128)
> draw.line((0, im.size[1], im.size[0], 0), fill=128)

Note the difference: in your original post, you passed
the line coordinates in a single argument.

(checking)

Yes, it's a glitch in the documentation on pythonware.com.
I thought we'd patched that, but maybe it never made it to
the side, and got lost in the great site reshuffle.

> I guess upgrading would help. When I run it on the Windows 95 box at
> work it runs just fine. I still wonder about the traceback though.

The ImageDraw line method looks like this:

    def line(self, xy, fill=None):

when you call this with two coordinates, Python assign the
first one to xy and the second to fill.  When Python gets to
the fill=128 argument, it has nowhere to put the value.

Cheers /F





More information about the Python-list mailing list