Python Turtle Attractive Petal design in Python import turtle # create the turtle object trt = turtle.Turtle() # create the screen object scr = turtle.Screen() #increase the pensize trt.pensize( 3 ) # set the background color to black scr.bgcolor( 'black' ) # set the pencolor to white colors = [ 'red' , 'orange' , 'yellow' , 'skyblue' , 'blue' , 'indigo' , 'violet' ] # increase the speed trt.speed( 0 ) # now first create a single petal # lets define the distance dis = 50 trt.color( "yellow" ) for color in range ( 20 ): for j in range ( 1 , 8 ): trt.left( 50 ) for i in range ( 2 ): trt.forward(dis) trt.left( 60 ) #rotate at 60 degree in clockwise trt.forward(dis) trt.left( 120 ) #rotate at 120 degree in clockwise dis = dis + 5 #hide the turtle after the shape has been drawn trt.hideturtle() turtle.done() Output : Learn thr...
Comments
Post a Comment