Colored Flower by circles using Turtle in Python
Last Updated :
01 Aug, 2020
Turtle is an inbuilt module in Python. It provides drawing using a screen (cardboard) and turtle (pen). To draw something on the screen, we need to move the turtle (pen). To move turtle, there are some functions i.e forward(), backward(), etc.
To draw Flower :
Following steps are used :
- Import Turtle
- Set screen
- Make Turtle Object
- Define colors used for drawing
- Loop to draw circles oriented by angle.
Below is the implementation :
Python3
import turtle
sc = turtle.Screen()
pen = turtle.Turtle()
col = [ 'violet' , 'indigo' , 'blue' , 'green' ,
'yellow' , 'orange' , 'red' ]
sc.setup( 500 , 500 )
sc.bgcolor( 'black' )
pen.pensize( 4 )
pen.speed( 20 )
i = 0
for angle in range ( 0 , 360 , 12 ):
pen.color(col[i])
if i = = 6 :
i = 0
else :
i + = 1
pen.seth(angle)
pen.circle( 80 )
pen.ht()
|
Output :
Share your thoughts in the comments
Please Login to comment...