Draw Spiralling Circles Using Turtle Graphics in Python
Last Updated :
01 Oct, 2020
Turtle is an inbuilt module of python. It enables us to draw any drawing by a turtle, methods defined in the turtle module, and by using some logical loops. To draw something on the screen(cardboard) just move the turtle(pen). To move turtle(pen) there are some functions i.e forward(), backward(), etc.
Approach:
- Import and create a turtle instance.
- Set the graphical visuals as per your needs.
- Run a for loop for some integer values i.
- For each value of i, draw a circle with a radius as i.
- Now rotate the turtle by a fixed degree.
Below is the implementation of the above approach
Python3
import turtle
animation = turtle.Turtle()
animation.speed( 0 )
animation.hideturtle()
animation.getscreen().bgcolor( "black" )
animation.color( "red" )
for i in range ( 100 ):
animation.circle(i)
animation._rotate( 5 )
|
Output:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...