def circle_flower(t, r): """ Draws a circle flower, t is a turtle, r is the radius of the circle """ for _ in range(6): arc(t, r, 60) t.lt(60) arc(t, r, 120) t.lt(60)
def petal(t, r, angle): """Draws a petal using two arcs. t: Turtle r: radius of the arcs angle: angle (degrees) that subtends the arcs """ for i in range(2): arc(t, r, angle) t.lt(180 - angle)
def yinyang(t): """ Draws a yinyang symbol, t is a turtle """ # draws the outter circle circle(t, 100) # draws the two arcr for _ in range(2): move(t, 0, 100) arc(t, 50, 180) # draws the two small circle move(t, 0, 35) circle(t, 15) move(t, 0, 135) circle(t, 15)
def draw_yinyang(t): # large circle circle(t, 100) # two arcs move(t, 0, 100) t.setheading(180) arc(t, 50, 180) move(t, 0, 100) t.setheading(0) arc(t, 50, 180) # small circles move(t, 0, 50 + 100 / 6) circle(t, 100 / 6) move(t, 0, 150 + 100 / 6) circle(t, 100 / 6)
def petal(t, r, angle): for i in range(2): arc(t, r, angle) t.lt(180 - angle)
import turtle from turtle_shape import arc, circle, move, polygon jerry = turtle.Turtle() jerry.speed(0) # large circle circle(jerry, 100) # two arcs move(jerry, 0, 100) jerry.setheading(180) arc(jerry, 50, 180) move(jerry, 0, 100) jerry.setheading(0) arc(jerry, 50, 180) # small circles move(jerry, 0, 50 + 100 / 6) circle(jerry, 100 / 6) move(jerry, 0, 150 + 100 / 6) circle(jerry, 100 / 6) turtle.mainloop()
move(bob, 0, 0) flower(bob, 10, 40.0, 80.0) lucky = turtle.Turtle() lucky.speed(0) # large circle circle(lucky, 100) # two arcs move(lucky, 0, 100) lucky.setheading(180) arc(lucky, 50, 180) move(lucky, 0, 100) lucky.setheading(0) arc(lucky, 50, 180) # small circles move(lucky, 0, 50 + 100 / 6) circle(lucky, 100 / 6) move(lucky, 0, 150 + 100 / 6) circle(lucky, 100 / 6) ef draw_spiral(t, n, length=3, a=0.1, b=0.0002): for i in range(n):
import turtle from turtle_shape import arc, circle, move, polygon jack = turtle.Turtle() jack.speed(0) # large circle circle(jack, 100) # two arcs move(jack, 0, 100) jack.setheading(180) arc(jack, 50, 180) move(jack, 0, 100) jack.setheading(0) arc(jack, 50, 180) # small circles move(jack, 0, 50 + 100 / 6) circle(jack, 100 / 6) move(jack, 0, 150 + 100 / 6) circle(jack, 100 / 6) turtle.mainloop()
import turtle from turtle_shape import arc, circle, move, polygon alex = turtle.Turtle() alex.speed(0) # large circle circle(alex, 100) # two arcs move(alex, 0, 100) alex.setheading(180) arc(alex, 50, 180) move(alex, 0, 100) alex.setheading(0) arc(alex, 50, 180) # small circles move(alex, 0, 50 + 100 / 6) circle(alex, 100 / 6) move(alex, 0, 150 + 100 / 6) circle(alex, 100 / 6) turtle.mainloop()