Draw a regular pentagon as shown below.
Hint:
A good place to start drawing is the point at the top. What should be the initial heading to draw the line left of the top point?
Related Projects:
Draw a regular pentagon as shown below.
Hint:
A good place to start drawing is the point at the top. What should be the initial heading to draw the line left of the top point?
Related Projects:
Draw the following hexagram with Python and Turtle.
Hint:
Think about where to start. The point at the bottom looks like a good starting point.
Related Projects:
Write a program that draw a diamonds suit shape with Python and Turtle. Please note that four sides are curves not straight lines.
A more challenging task is to make a function that draws a diamond shape at any center location , width, height, and arc angle. For example the diamond shape above has width/height ratio of 3/4 and four sides are arcs with 20 degree angle. You may need to apply basic trigonometry knowledge to solve this problem.
Source Code:
import turtle
import math
screen = turtle.Screen()
screen.title('Diamond Shape - PythonTurtle.Academy')
screen.setup(1000,1000)
screen.setworldcoordinates(-1000,-1000,1000,1000)
turtle.speed(0)
turtle.hideturtle()
def diamond(x,y, width, height, angle):
turtle.up()
turtle.color('red')
turtle.goto(x,y-height/2)
d = ((width/2)**2 + (height/2)**2)**0.5
radius = d*0.5/math.sin(math.radians(angle/2))
turtle.down()
turtle.begin_fill()
turtle.seth(turtle.towards(x-width/2,y)-angle/2)
turtle.circle(radius, angle,20)
turtle.seth(turtle.towards(x,y+height/2)-angle/2)
turtle.circle(radius, angle,20)
turtle.seth(turtle.towards(x+width/2,y)-angle/2)
turtle.circle(radius, angle,20)
turtle.seth(turtle.towards(x,y-height/2)-angle/2)
turtle.circle(radius, angle,20)
turtle.end_fill()
diamond(0,0,1200,1600,20)
Trefoil, comes from Lantin, means three-leaved plant. It is a shape used in architecture and Christian symbolism. For more details about this shape checkout this Wikipedia article.
Hint: This shape is composed of three arcs with extent of 240 degrees.
Draw a pacman shape as shown. The opening angle of the mouth is 60 degrees. You can try to draw other opening angles.
Hint: Start from the center, draw a line, draw an arc, go to the center.
Draw a simple parallelogram with Python and Turtle. It can have any angles and any side lengths.
Draw a simple dog bone shape with Python and Turtle. This shape contains 2 lines and 4 arcs. You can draw the shape in one stroke without lifting the pen up. You can also fill the bone with the a color of your choice.
You can post your solution in the comment section.
The figure above shows, we can draw a simple heart shape with 4 segments: 2 lines and 2 arcs. We can continuously draw these 4 segments without lifting up the pen.
We start from the bottom tip of the heart. The heading for the blue line is 45 degrees. The second segment is 225 degree arc. After initial 45 degree heading and 225 degree turn, the heading of the turtle will be a 45+225=270 degrees, which is facing down perfectly. The rest of the two segments are symmetric to the first two. All we need to do is just turn the Turtle by 180 degrees before drawing the 3rd segment.
The next step is to figure out the ratio of blue segment and the radius of the arc. In the figure above, a triangle formed by two black lines and the blue line is a right triangle. The angle between two black lines is (360-225)/2 = 67.5 degrees, where 225 is the degree of the arc. Therefore, the ratio of blue line segment and the radius equals to tangent(67.5).
Here is the code:
import turtle
import math
turtle.color('red')
d = 800
r = d/math.tan(math.radians(67.5))
turtle.up()
turtle.goto(0,-600)
turtle.seth(45)
turtle.down()
turtle.fd(d)
turtle.circle(r,225)
turtle.left(180)
turtle.circle(r,225)
turtle.fd(d)
You can easily draw a filled heart by calling begin_fill() and end_fill() functions:
turtle.color('red')
d = 800
r = d/math.tan(math.radians(67.5))
turtle.up()
turtle.goto(0,-600)
turtle.seth(45)
turtle.begin_fill()
turtle.down()
turtle.fd(d)
turtle.circle(r,225)
turtle.left(180)
turtle.circle(r,225)
turtle.fd(d)
turtle.end_fill()
Related Projects:
Draw a five pointed star as shown preferably with a loop.
The following red cross with Python and Turtle. You need to fill it with a color.
Source Code:
import turtle
screen = turtle.Screen()
screen.title('Red Cross - PythonTurtle.Academy')
screen.setup(1000,1000)
turtle.speed(0)
turtle.hideturtle()
turtle.color('red')
turtle.up()
turtle.goto(-450,-150)
turtle.down()
turtle.begin_fill()
for _ in range(4):
turtle.fd(300)
turtle.right(90)
turtle.fd(300)
turtle.left(90)
turtle.fd(300)
turtle.left(90)
turtle.end_fill()