[Tutor] Polygon fill in turtle
Alan Gauld
alan.gauld at yahoo.co.uk
Tue Mar 27 19:07:24 EDT 2018
On 27/03/18 22:10, Roger Lea Scherer wrote:
> outlineColor = input("What color would you like for the outline?")
> filler = input("And what color would you like to fill it with? ")
>
> hadir.begin_fill()
> hadir.color(outlineColor)
> print(filler)
> for i in range(sides):
> hadir.forward(length)
> hadir.left(360 / sides)
> hadir.up()
> hadir.end_fill()
You don't actually set the fill color anywhere.
Here is a sequence I used that worked:
>>> t1 = turtle.Turtle()
>>> t1.color('red','blue')
>>> t1.begin_fill()
>>> t1.circle(40)
>>> t1.end_fill()
Note the call to color() to set the pen and fill colors.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list