python turtle fill colour code example
Example 1: turtle fillcolor
from turtle import *
color('red', 'yellow')
begin_fill()
while True:
forward(200)
left(170)
if abs(pos()) < 1:
break
end_fill()
done()
Example 2: how to fill a shape with colour in python turtle
fillcolor(): This helps to choose the color for filling the shape. It takes the input parameter as the color name or hex value of the color and fills the upcoming closed geographical objects with the chosen color. Color names are basic color names i.e. red, blue, green, orange.
The hex value of color is a string(starting with ‘
begin_fill(): This function tells turtle that all upcoming closed graphical objects needed to be filled by the chosen color.