[Tutor] Ongoing trouble with Turtle's end_fill()

Dick Moores rdmoores at gmail.com
Wed Aug 6 00:49:14 CEST 2008


For a while now I've had trouble with end_fill(). Sometimes I can use
it to fill a figure such as a square, triangle or rectangle, but
sometimes not.

Here's a barebones script using end_fill(). As you can see, it draws a
square twice, but fails to fill it. Pleas show me how to use it
correctly in tandem with begin_fill().

The Turtle doc is at <http://docs.python.org/lib/module-turtle.html>

============================
from turtle import *
import time

setup(width=1000, height=700, startx=0, starty=0)
for n in range(2):
    begin_fill()
    color_name = 'red'
    x, y = 50, 50
    color(color_name)
    print color_name
    up()
    goto(x, y)
    down()
    goto(x, -y)
    goto(-x, -y)
    goto(-x, y)
    goto(x, y)
    end_fill()
    print "end_fill()"
    time.sleep(1)
    clear()
=====================================

Thanks,

Dick Moores


More information about the Tutor mailing list