Introduction
This article will discuss how to draw color-filled shapes in python using the turtle module. Turtle is a pre-installed module in python that lets you draw various shapes and figures using python with a provided virtual canvas. Using this, you can create graphics, pictures, and games.
Also see, Merge Sort Python
Draw color-filled shapes in Turtle
Turtle module of Python has three functions fillcolor(), begin_fill(), and end_fill(), which can be used to draw color-filled shapes. These three functions are the primary keys that will be used to draw all sorts of color-filled shapes like squares, triangles, circles, stars, etc.
The description of each of these three functions is discussed below:
fillcolor(*args)
This function returns or sets fill color. I
The parameters to fillcolor method can be passed in the following 4 formats:
-
fillcolor(): When no arguments are passed, the fill color() method returns the current fill color. This returned value can be used as a parameter to other functions like color, setcolor, or fillcolor.
-
fillcolor(colorstring): This format sets the color to colorstring specified. The colorstring is a Tk color specification string such as “blue”, “red”, “#ffffff”.
-
fillcolor((r, g, b)): This format sets the color to the color represented by the tuple r, g, and b. Each of r, g, and b in the tuple is a floating-point number in the range 0 to color mode, where color mode can be either 1.0 or 255.
- fillcolor(r, g, b): This format sets the color to the color represented by the values of r, g, and b. Each of r, g, and b is a floating-point number in the range 0 to color mode, where color mode can be either 1.0 or 255.
begin_fill()
This function indicates the starting point of the shape to be filled. It should be called just before you start drawing the shape that needs to be filled with some color.
end_fill()
This function should be called after the begin_fill() function and when you are done drawing the shape. It fills the color inside the shape created after the last begin_fill() function.
Read about, Fibonacci Series in Python








