Lesson 22: Draw THANK with turtle

posted Jun 7, 2019, 8:07 AM by Attila Lengyel
import turtle as t

tt = t.Turtle()

def draw_t(bob,x,y):
bob.penup()
bob.goto(x,y)
bob.pendown()
bob.forward(50)
bob.left(180)
bob.forward(25)
bob.left(90)
bob.forward(60)
bob.left(90)

def draw_h(bob,x,y):
bob.penup()
bob.goto(x,y)
bob.pendown()
bob.right(90)
bob.forward(60)
bob.left(180)
bob.forward(30)
bob.right(90)
bob.forward(30)
bob.left(90)
bob.forward(30)
bob.left(180)
bob.forward(60)
bob.left(90)

def draw_a(bob, x,y):
bob.penup()
bob.goto(x,y)
bob.pendown()
bob.goto(x + 15, y + 60)
bob.goto(x + 30, y + 0)
bob.penup()
bob.goto(x,y + 30)
bob.pendown()
bob.goto(x + 30, y + 30)

def draw_n(bob, x, y):
bob.penup()
bob.goto(x,y)
bob.pendown()
bob.left(90)
bob.forward(60)
bob.goto(x + 30, y)
bob.forward(60)
bob.right(90)

def draw_k(bob, x, y):
bob.penup()
bob.goto(x,y)
bob.pendown()
bob.right(90)
bob.forward(60)
bob.right(180)
bob.forward(25)
bob.goto(x + 30 ,y)
bob.goto(x,y -35)
bob.goto(x + 30 ,y - 60)
draw_t(tt, -200, 200)
draw_h(tt, -140, 200)
draw_a(tt, -100, 140)
draw_n(tt, -60, 140)
draw_k(tt, -20, 200)

Comments