Turtle With Flower Shell Drawing
Tutorial: Drawing a Flower Petal or a Leaf with Python Turtle
In this tutorial we are going to show how to draw a flower's petal (or a leaf). This is a simple two step process: 1. draw an arc of a circle 2. turn around and draw the other arc.
Step 1: Drawing the first arc. Obviously, we are not drawing a full circle. You can use the extent value to decide how many degree arc to draw. Usually, a number between 60 to 120 will create a good looking petal. The bigger the angle, the wider the petal will become. In this example, we are going to use 70 degrees. The following is the code snippet for the first arc:
turtle.up() turtle.goto(-100,-100) turtle.down() turtle.circle(300,70)
Step 2: Drawing the second arc. We need to draw the second arc in the opposite direction to the first arc so that it can go back to the original position. Since the heading of the turtle changed by the degree of the first arc, you just need to turn 180 minus the degree of the first arc. Since, we used 70 degrees in the example above, we will turn left 110 (180-70) degrees. The following is the code snippet to draw the second arc:
turtle.left(110) turtle.circle(300,70)
Now we just to color it with your favorite color. The following is the complete code for drawing the flower petal:
turtle.up() turtle.goto(-100,-100) turtle.down() turtle.fillcolor('yellow') turtle.begin_fill() turtle.circle(300,70) turtle.left(110) turtle.circle(300,70) turtle.end_fill()
Challenge: Draw a five petal flower.
Turtle With Flower Shell Drawing
Source: https://pythonturtle.academy/tutorial-drawing-a-flower-petal-or-a-leaf-with-python-turtle/
Posted by: kirbythimakeent.blogspot.com
0 Response to "Turtle With Flower Shell Drawing"
Post a Comment