Files
problemset_typeface/typeface.py
root 801ba8edbf I finished the function for drawing the letter A.
I am frustrated that my commit messages keep failing to save and I have
to keep rewriting them.
First I wrote the function and it was very long. Then, I made functions
for the eyes and ghosty skirt, since I will use them in other letters.
I feel like I should use loops but I don't want to mess up my letter.
I tried one way, and it didn't work, so I think I will try for the
letter B and then go back and change A as needed.
2024-09-19 23:36:19 -04:00

139 lines
2.2 KiB
Python

# typeface.py
# By Chris Proctor and _________
# Contains one function for each letter in the English alphabet.
# Each function should draw its letter at a scale of `unit`, and then
# return back to the same position and heading where it started.
# Note: The `sqrt` function from math may be helpful--if you want to
# move the turtle along the diagonal of a square with side length x,
# the turtle should move a distance of sqrt(x)
from turtle import *
from math import sqrt
def draw_eye(unit):
right(45)
pendown()
fillcolor('black')
begin_fill()
circle(unit/2, 90)
circle(unit/12, 90)
circle(unit/2, 90)
circle(unit/12, 90)
end_fill()
penup()
left(45)
def draw_ghostyskirt(unit):
circle(-unit/4, 180)
circle(unit/4, 180)
circle(-unit/4, 180)
circle(unit/4, 180)
circle(-unit/4, 180)
circle(unit/4, 180)
circle(-unit/4, 180)
def draw_letter_a(unit):
left(90)
penup()
forward(unit/4)
pendown()
forward(15*unit/4)
circle(-4*unit, 180)
forward(15*unit/4)
draw_ghostyskirt(unit)
forward(2*unit)
circle(unit/2, 180)
forward(2*unit)
draw_ghostyskirt(unit)
penup()
forward(15*unit/4)
right(90)
forward(4*unit)
pendown()
circle(unit)
penup()
circle(unit, 90)
forward(5*unit/4)
draw_eye(unit)
left(90)
forward(2*unit)
draw_eye(-unit)
def draw_letter_b(unit):
pass
def draw_letter_c(unit):
pass
def draw_letter_d(unit):
pass
def draw_letter_e(unit):
pass
def draw_letter_f(unit):
pass
def draw_letter_g(unit):
pass
def draw_letter_h(unit):
pass
def draw_letter_i(unit):
pass
def draw_letter_j(unit):
pass
def draw_letter_k(unit):
pass
def draw_letter_l(unit):
pass
def draw_letter_m(unit):
pass
def draw_letter_n(unit):
pass
def draw_letter_o(unit):
pass
def draw_letter_p(unit):
pass
def draw_letter_q(unit):
pass
def draw_letter_r(unit):
pass
def draw_letter_s(unit):
pass
def draw_letter_t(unit):
pass
def draw_letter_u(unit):
pass
def draw_letter_v(unit):
pass
def draw_letter_w(unit):
pass
def draw_letter_x(unit):
pass
def draw_letter_y(unit):
pass
def draw_letter_z(unit):
pass