generated from mwc/problemset_typeface
I edited pass for i,l,p, and h so that the turtle
drew those letters in the grid, so the units would remain the same even when the size of the typeface changed. I found this lab to be really helpful. It was a scaffolded way of allowing for trial and error with all the techniques we have learned in python so far. As I worked through this I found myself asking, is there a more efficent way of doing this? or thinking, can I challenge myself to do this diffeently. From a teaching standpoint, it was really helpful to have this lab after the drawing project was assigned. I was able to test and try different things I might want to use in thet project. It was a nice built-in opportunity for troubleshooting.
This commit is contained in:
parent
a276bac89a
commit
bb138546f6
152
typeface.py
152
typeface.py
|
@ -12,8 +12,9 @@
|
|||
from turtle import *
|
||||
from math import sqrt
|
||||
|
||||
def draw_letter_a(unit):
|
||||
def draw_letter_a(size):
|
||||
pass
|
||||
|
||||
|
||||
def draw_letter_b(unit):
|
||||
pass
|
||||
|
@ -34,10 +35,93 @@ def draw_letter_g(unit):
|
|||
pass
|
||||
|
||||
def draw_letter_h(unit):
|
||||
pass
|
||||
penup()
|
||||
forward(unit * 1)
|
||||
pendown()
|
||||
left(90)
|
||||
forward(unit * 6)
|
||||
right(90)
|
||||
forward(unit * 2)
|
||||
right(90)
|
||||
forward(unit * 2)
|
||||
left(90)
|
||||
forward(unit * 1)
|
||||
left(90)
|
||||
forward(unit * 2)
|
||||
right(90)
|
||||
forward(unit * 2)
|
||||
right(90)
|
||||
forward(unit * 6)
|
||||
right(90)
|
||||
forward(unit * 2)
|
||||
right(90)
|
||||
forward(unit * 3)
|
||||
left(90)
|
||||
forward(unit * 1)
|
||||
left(90)
|
||||
forward(unit * 3)
|
||||
right(90)
|
||||
forward(unit * 2)
|
||||
"Above is body of the H"
|
||||
penup()
|
||||
right(90)
|
||||
forward(unit * 1)
|
||||
right(90)
|
||||
forward(unit * .5)
|
||||
pendown()
|
||||
def rectangle(width,height):
|
||||
for _ in range(2):
|
||||
forward(width)
|
||||
left(90)
|
||||
forward(height)
|
||||
left(90)
|
||||
rectangle(unit * .5,unit * 4)
|
||||
penup()
|
||||
forward(unit * 3.5)
|
||||
pendown()
|
||||
rectangle(unit * .5, unit * 4)
|
||||
penup()
|
||||
left(90)
|
||||
forward(unit * 2.75)
|
||||
pendown()
|
||||
left(90)
|
||||
rectangle(unit * 3, unit * .5)
|
||||
penup()
|
||||
forward(unit * 5)
|
||||
left(90)
|
||||
forward(unit * 3.75)
|
||||
left(90)
|
||||
|
||||
|
||||
|
||||
def draw_letter_i(unit):
|
||||
pass
|
||||
penup()
|
||||
forward(unit * 3)
|
||||
left(90)
|
||||
forward(unit * 6)
|
||||
def square(side_length):
|
||||
for _ in range(4):
|
||||
forward(side_length)
|
||||
right(90)
|
||||
pendown()
|
||||
square(unit * 1)
|
||||
right (180)
|
||||
penup()
|
||||
forward(unit * 1)
|
||||
pendown()
|
||||
forward(unit * 5)
|
||||
left(90)
|
||||
forward(unit * 1)
|
||||
left(90)
|
||||
forward(unit * 5)
|
||||
left(90)
|
||||
forward(unit * 1)
|
||||
penup()
|
||||
left(90)
|
||||
forward(unit * 5)
|
||||
right(90)
|
||||
forward(unit * 3)
|
||||
right(180)
|
||||
|
||||
def draw_letter_j(unit):
|
||||
pass
|
||||
|
@ -46,7 +130,26 @@ def draw_letter_k(unit):
|
|||
pass
|
||||
|
||||
def draw_letter_l(unit):
|
||||
pass
|
||||
penup()
|
||||
forward(unit * 2)
|
||||
pendown()
|
||||
left(90)
|
||||
forward(unit * 7)
|
||||
"Above draws initial line in L"
|
||||
right(90)
|
||||
forward(unit * 2)
|
||||
right(90)
|
||||
forward(unit * 5)
|
||||
left(90)
|
||||
forward(unit * 2)
|
||||
right(90)
|
||||
forward(unit * 2)
|
||||
right(90)
|
||||
forward(unit * 4)
|
||||
penup()
|
||||
forward(unit * 2)
|
||||
right(180)
|
||||
|
||||
|
||||
def draw_letter_m(unit):
|
||||
pass
|
||||
|
@ -58,7 +161,46 @@ def draw_letter_o(unit):
|
|||
pass
|
||||
|
||||
def draw_letter_p(unit):
|
||||
pass
|
||||
penup()
|
||||
forward(unit * 1)
|
||||
pendown()
|
||||
left(90)
|
||||
forward(unit * 6)
|
||||
right(90)
|
||||
forward(unit * 2)
|
||||
right(45)
|
||||
forward(unit * sqrt(2))
|
||||
right(45)
|
||||
forward(unit * 1)
|
||||
right(45)
|
||||
forward(unit * sqrt(2))
|
||||
right(45)
|
||||
forward(unit * .5)
|
||||
left(90)
|
||||
forward(unit * 3)
|
||||
right(90)
|
||||
forward(unit * 1.5)
|
||||
penup()
|
||||
right(90)
|
||||
forward(unit * 4.75)
|
||||
right(90)
|
||||
forward(unit * 1)
|
||||
pendown()
|
||||
def square(side_length):
|
||||
for _ in range(4):
|
||||
forward(side_length)
|
||||
right(90)
|
||||
square(unit * .75)
|
||||
right(90)
|
||||
penup()
|
||||
forward(unit * 4.75)
|
||||
right(90)
|
||||
forward(unit * 2)
|
||||
right(180)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def draw_letter_q(unit):
|
||||
pass
|
||||
|
|
Loading…
Reference in New Issue