Draw Circle using Turtle Programming
Introduction
This article will discuss using the turtle module to draw circles and other circle-related shapes in python. 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.
Draw a circle using turtle programming
A circle can be quickly drawn in python using turtle programming. The turtle module has a built-in function that takes the circle's radius as input and draws a circle with the specified radius. To do so, we have to first create a turtle object and then, using this object, call the circle method.
Following is the python implementation to draw a circle using turtle programming.
#importing turtle module
import turtle
#Initialising the turtle object
tt = turtle.Turtle()
#using built-in function to draw a circle
radius = 100
tt.circle(100)
# Finish by turtle.done() command
turtle.done()
Output

You can practice by yourself with the help of online python compiler for better understanding.
Draw spiral circle using turtle programming
A Spiral is a curve similar to a circle in which the radius keeps on increasing with each added circle. The circle method in the turtle module takes three arguments: radius, the extent, and the steps. As the name suggests, the radius specifies the radius of the circle. The extent specifies the angle to which we have to draw the circle. For example, extend of180 means that a half-circle will be drawn. In the last argument, steps specify how many lines should be drawn of equal length to make a closed curve.
To draw a spiral circle, we will increment the radius each time and give an extent of 45. Following is the python implementation to draw a spiral circle using turtle programming.
#importing turtle module
import turtle
#Initializing the turtle object
tt = turtle.Turtle()
radius = 50
#Loop to draw a spiral circle
for i in range(100):
tt.circle(radius + i, 45)
# Finish by turtle.done() command
turtle.done()
Output

Draw Tangent circles using turtle programming
A Tangent is a line that touches the circumference of the circle only once, and any extension of the lines doesn’t intersect the circle at any point. Tangent circles are the group of circles that have a common tangent line.
Following is the python implementation to draw tangent circles using turtle programming.
#importing turtle module
import turtle
#Initialized the turtle object
tt = turtle.Turtle()
radius = 10
n = 8
#Loop to draw tangent circles
for i in range(1, n + 1):
tt.circle(radius * i)
# Finish by turtl.done() command
turtle.done()
Output

Draw Concentric circles using turtle programming
Concentric circles are the group of circles that has a common center point. All the circles in a group of common circles have a common center point but a different radius.
Following is the python implementation to draw concentric circles using turtle programming.
#importing turtle module
import turtle
#Initialized the turtle object
tt = turtle.Turtle()
radius = 15
# Loop drawing concentric circles
for i in range(1, 15):
tt.circle(radius * i)
tt.up()
tt.sety((radius * i)*(-1))
tt.down()
# Finish by turtl.done() command
turtle.done()
Output

Frequently Asked Questions
-
What is the use of turtle programming in python?
Turtle programming is used to create graphics, pictures, and games. Students or kids can create fun programs with only a few lines and code with turtle programming.
-
Is turtle a pre-installed library?
Yes, turtle comes in the standard python package, so it does not need to be downloaded explicitly. You can import it directly into your program.
-
What command is used to create a virtual canvas or a window to draw figures in turtle programming?
The turtle.Screen() command is used to create a virtual canvas or a window to draw figures in turtle programming.
-
What arguments does the built-in circle method take in the turtle module?
The circle method in the turtle module takes three arguments: radius, the extent, and the steps.
-
How can we draw a color-filled shape in python using the turtle module?
A color-filled shape can be drawn using the turtle module with the help of three functions that are fillcolor(*args), begin_fill(), and end_fill(). The shape must be drawn between the begin_fill() and the end() methods.
Conclusion
In this article, we discussed drawing circles in python using turtle programming. We also discussed drawing spiral circles, concentric circles, and tangent circles. Hope you would have gained a better understanding of these topics now!
Are you planning to ace the interviews of reputed product-based companies like Amazon, Google, Microsoft, and more?
Attempt our Online Mock Test Series on CodeStudio now!
Happy Coding!