Kathryn Odell-Hamilton

8.22.2023

- With the assistance of Dr. Proctor, I imported the following into
drawing.py:
   from superturtle.movement import no_delay
   from typeface import (the letters pietmondrian)
Each letter was referenced to the letter function within typeface.py to
draw the type, PIET MONDRIAN appeared at the top without delay.

- Also, I was shown how to add the type in animated_square.py file.
I added 2 more function squares, so the 3 red, yellow, and blue squares
animated with the type, PIET.

Thank you. This was a great experience with type and animation!
_____
Submitted 8.17.2023

I created a program within a grid layout of drawing varying weight and
length of lines horizontal and vertical with one filled square and
two filled rectangles with primary colors, red, blue, yellow.

- Somewhere I got stuck was trying to import square.py, drawing_fly, and
animated_square.py. I wanted to add the typeface.py, so I copied
grid.py, proof.py, typeface.py into project_drawing folder and modified
the alphabet to read PIET MONDRIAN, but the proof.py blipped asking
for a letter. I even tried to copy the letter A within the drawing.py,
but it didn't work. Then I wanted to incorporate an animate at the end
on the blue square. I added "from superturtle.animation import animate"
and "from turtle import forward, right", the program ran fine until the
end where the design disappeared, and the blue square animate appeared
only on the screen. I did a test that worked and reviewed the tile.py.

- I did my research on this drawing project with several Piet Mondrian
samples. I created a Unit 1_Project_Planning_Drawing.doc file.

- I figured out from reviewing docs.python.org/3/library/turtle.html#module-turtle
and codehs.com/documentation/new/python-turtle#docs-commands how to
change the screen size, positioning the pen with setposition, and fill
square and rectangles with color. I figured out how to speed up the
drawing process without using --fast.

- I defined a square with a for loop a few times instead of repeating
the code. When I used the "for side in range(2)" when filling the two
rectangles.

- I am wondering how I could create squares and rectangles with varying
weight lines on each side. How can I import and the text from typeface.py.
How can I use the fly to go to the point instead of right/left(90) and
forward().

I would like to learn how to streamline drawing.py. I know it can be
done. Duplicating horizontal and vertical lines with varying weights.
Using proper coding when importing from other python files, add
animation, creating a defined rectangle(width, length) with a for-loop
and using x y coordinates to draw multiple squares and rectangles that
are adjacent to each other with different color fills.
This commit is contained in:
kathrynoh23 2023-08-22 16:02:16 -04:00
parent f235bcf0e9
commit cadf0fffc2
5 changed files with 609 additions and 15 deletions

Binary file not shown.

View File

@ -1,21 +1,41 @@
from superturtle.animation import animate from superturtle.animation import animate
from turtle import * from turtle import *
from turtle import forward, right from turtle import forward, right
from typeface import (
draw_letter_p,
draw_letter_i,
draw_letter_e,
draw_letter_t,
)
pensize(3)
begin_fill() begin_fill()
def square(side_length): def square(side_length):
pensize(None)
fillcolor('blue') fillcolor('blue')
begin_fill() begin_fill()
for side in range(4): for side in range(4):
forward(side_length) forward(side_length)
right(90) right(90)
end_fill()
for i in range(3):
#animates 3 times and then stops
for frame in animate(40, loop=True): for frame in animate(40):
size = frame.interpolate(50, 100, mirror=True) size = frame.interpolate(50, 100, mirror=True)
square(size) square(size)
penup()
back(90)
pendown()
draw_letter_p(size/4)
forward(63)
draw_letter_i(size/4)
forward(22)
draw_letter_e(size/4)
forward(75)
draw_letter_t(size/4)
done()
end_fill()

View File

@ -8,10 +8,27 @@ across to create one fill square and two fill rectangles in a Piet Mondrian abst
a few shapes (squares and rectangles) will be drawn and filled with primary colors, red, blue, yellow. a few shapes (squares and rectangles) will be drawn and filled with primary colors, red, blue, yellow.
""" """
from superturtle.animation import animate
from turtle import forward, right
from turtle import * from turtle import *
from superturtle.movement import no_delay
from typeface import (
draw_letter_p,
draw_letter_i,
draw_letter_e,
draw_letter_t,
draw_letter_m,
draw_letter_o,
draw_letter_n,
draw_letter_d,
draw_letter_r,
draw_letter_i,
draw_letter_a,
draw_letter_n,
)
screensize(500, 500) screensize(500, 500)
speed(9) speed(10)
# Positioning pen in upper left of screen # Positioning pen in upper left of screen
penup() penup()
@ -23,7 +40,6 @@ pendown()
pencolor("black") pencolor("black")
pensize(2) pensize(2)
# Drawing a square # Drawing a square
def square(side_length): def square(side_length):
for side in range(4): for side in range(4):
@ -175,6 +191,7 @@ for side in range(2):
right(90) right(90)
end_fill() end_fill()
fillcolor('white')
# Go back to beginning, top left # Go back to beginning, top left
penup() penup()
@ -182,7 +199,67 @@ pencolor('black')
setposition(-200, 200) setposition(-200, 200)
"""hide and show turtle to make sure lines are butting to each other""" #Draw letters PIET MONDRIAN, ARTIST
left(90)
forward(40)
right(90)
with no_delay():
penup()
back(60)
pendown()
draw_letter_p(25/4)
forward (33)
draw_letter_i(25/4)
penup()
forward (15)
pendown()
draw_letter_e(25/4)
penup()
forward (40)
pendown()
draw_letter_t(25/4)
penup()
forward (40)
pendown()
draw_letter_m(25/4)
penup()
forward (46)
pendown()
draw_letter_o(25/4)
penup()
forward (46)
pendown()
draw_letter_n(25/4)
penup()
forward (46)
pendown()
draw_letter_d(25/4)
penup()
forward (46)
pendown()
draw_letter_r(25/4)
penup()
forward (34)
pendown()
draw_letter_i(25/4)
penup()
forward (13)
pendown()
draw_letter_a(25/4)
penup()
forward (38)
pendown()
draw_letter_n(25/4)
# Go back to beginning, top left of square box
penup()
pencolor('black')
setposition(-200, 200)
#hide and show turtle to make sure lines are butting to each other
hideturtle() hideturtle()
done() done()

14
poetry.lock generated
View File

@ -159,13 +159,13 @@ files = [
[[package]] [[package]]
name = "furo" name = "furo"
version = "2023.8.17" version = "2023.8.19"
description = "A clean customisable Sphinx documentation theme." description = "A clean customisable Sphinx documentation theme."
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.8"
files = [ files = [
{file = "furo-2023.8.17-py3-none-any.whl", hash = "sha256:baed406fc8f75a585caa330756b6841e6a1d4c844a3a355387e01ba9d1a4c6ee"}, {file = "furo-2023.8.19-py3-none-any.whl", hash = "sha256:12f99f87a1873b6746228cfde18f77244e6c1ffb85d7fed95e638aae70d80590"},
{file = "furo-2023.8.17.tar.gz", hash = "sha256:56664be7290d1457a49d6c2c98cbf96537b9ee1cf05d28e05a5178e76abe5c55"}, {file = "furo-2023.8.19.tar.gz", hash = "sha256:e671ee638ab3f1b472f4033b0167f502ab407830e0db0f843b1c1028119c9cd1"},
] ]
[package.dependencies] [package.dependencies]
@ -479,13 +479,13 @@ test = ["pytest"]
[[package]] [[package]]
name = "sphinxcontrib-serializinghtml" name = "sphinxcontrib-serializinghtml"
version = "1.1.8" version = "1.1.9"
description = "sphinxcontrib-serializinghtml is a sphinx extension which outputs \"serialized\" HTML files (json and pickle)" description = "sphinxcontrib-serializinghtml is a sphinx extension which outputs \"serialized\" HTML files (json and pickle)"
optional = false optional = false
python-versions = ">=3.9" python-versions = ">=3.9"
files = [ files = [
{file = "sphinxcontrib_serializinghtml-1.1.8-py3-none-any.whl", hash = "sha256:27849e7227277333d3d32f17c138ee148a51fa01f888a41cd6d4e73bcabe2d06"}, {file = "sphinxcontrib_serializinghtml-1.1.9-py3-none-any.whl", hash = "sha256:9b36e503703ff04f20e9675771df105e58aa029cfcbc23b8ed716019b7416ae1"},
{file = "sphinxcontrib_serializinghtml-1.1.8.tar.gz", hash = "sha256:aaf3026335146e688fd209b72320314b1b278320cf232e3cda198f873838511a"}, {file = "sphinxcontrib_serializinghtml-1.1.9.tar.gz", hash = "sha256:0c64ff898339e1fac29abd2bf5f11078f3ec413cfe9c046d3120d7ca65530b54"},
] ]
[package.dependencies] [package.dependencies]

497
typeface.py Normal file
View File

@ -0,0 +1,497 @@
# 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
pensize(5)
def draw_letter_a(unit):
penup()
forward(unit*1)
pendown()
# 1st & 2nd stem sections of letter
forward(unit*2)
left(90)
forward(unit*3)
right(90)
forward(unit*2)
right(90)
forward(unit*3)
left(90)
forward(unit*2)
left(90)
forward(unit*6)
# 45 degree top section of letter
left(45)
forward(unit * 2 * sqrt(2))
left(45)
forward(unit*2)
left(45)
forward(unit * 2 * sqrt(2))
left(45)
#remander of left stem section of letter
forward(unit*6)
left(90)
#interior cross bar section
penup()
left(90)
forward(unit*4)
right(90)
forward(unit*2)
pendown()
forward(unit*2)
left(90)
forward(unit*1)
left(45)
forward(unit * 1 * sqrt(2))
left(90)
forward(unit * 1 * sqrt(2))
left(45)
forward(unit*1)
#penup moving back to initial position
penup()
right(90)
forward(unit*2)
left(90)
forward(unit*4)
# Start position
left(90)
def draw_letter_b(unit):
pass
def draw_letter_c(unit):
pass
def draw_letter_d(unit):
penup()
forward(unit*1)
"Draw base and right side of D"
pendown()
forward(unit*4)
left(45)
forward(unit * 2 * sqrt(2))
left(45)
forward(unit*4)
left(45)
forward(unit * 2 * sqrt(2))
"Top and left side of D"
left(45)
forward(unit*4)
left(90)
forward(unit*8)
"Inner section of D"
penup()
left(180)
forward(unit*2)
right(90)
forward(unit*2)
pendown()
forward(unit*1)
left(45)
forward(unit * 1 * sqrt(2))
left(45)
forward(unit*2)
left(45)
forward(unit * 1 * sqrt(2))
left(45)
forward(unit*1)
left(90)
forward(unit*4)
"Back to beginning"
penup()
right(90)
forward(unit*3)
left(90)
forward(unit*2)
left(90)
def draw_letter_e(unit):
penup()
forward(unit*1)
pendown()
#Base leg section
forward(unit*6)
left(90)
forward(unit*2)
left(90)
forward(unit*4)
right(90)
# middle section
forward(unit*1)
right(90)
forward(unit*4)
left(90)
forward(unit*2)
left(90)
forward(unit*4)
right(90)
# arm (top) section
forward(unit*1)
right(90)
forward(unit*4)
left(90)
forward(unit*2)
left(90)
forward(unit*6)
# completing stem of letter
left(90)
forward(unit*8)
# Start position
left(90)
def draw_letter_f(unit):
pass
def draw_letter_g(unit):
pass
def draw_letter_h(unit):
pass
def draw_letter_i(unit):
# penup to move into position to draw
penup()
forward(unit*3)
pendown()
#Stem of letter "I"
forward(unit*2)
left(90)
forward(unit*8)
left(90)
forward(unit*2)
left(90)
forward(unit*8)
#Start position
left(90)
def draw_letter_j(unit):
pass
def draw_letter_k(unit):
pass
def draw_letter_l(unit):
pass
def draw_letter_m(unit):
penup()
forward(unit*1)
"beginning stem section and bottom section of N"
pendown()
forward(unit*2)
left(90)
forward(unit*4)
right(135)
forward(unit * 1 * sqrt(2))
left(90)
forward(unit * 1 * sqrt(2))
right(45)
right(90)
forward(unit*4)
left(90)
forward(unit*2)
"Right stem section and top of N"
left(90)
forward(unit*8)
left(90)
forward(unit*2)
left(45)
forward(unit * 1 * sqrt(2))
right(90)
forward(unit * 1 * sqrt(2))
left(45)
forward(unit*2)
"Left stem of N"
left(90)
forward(unit*8)
"Back to beginning"
penup()
right(90)
forward(unit*1)
right(180)
def draw_letter_n(unit):
penup()
forward(unit*1)
"1st stem section and angle of N"
pendown()
forward(unit*2)
left(90)
forward(unit*3)
right(135)
forward(unit * 3 * sqrt(2))
left(45)
forward(unit*1)
"Right and top of N"
left(90)
forward(unit*8)
left(90)
forward(unit*2)
left(90)
forward(unit*3)
right(135)
forward(unit * 3 * sqrt(2))
left(45)
forward(unit*1)
"Left side of stem N"
left(90)
forward(unit*8)
"Back to beginning"
penup()
right(90)
forward(unit*1)
right(180)
def draw_letter_o(unit):
penup()
forward(unit*3)
"Draw base of O"
pendown()
forward(unit*2)
"Right side and top of O"
left(45)
forward(unit * 2 * sqrt(2))
left(45)
forward(unit*4)
left(45)
forward(unit * 2 * sqrt(2))
left(45)
forward(unit*2)
"Left side of O"
left(45)
forward(unit * 2 * sqrt(2))
left(45)
forward(unit*4)
left(45)
forward(unit * 2 * sqrt(2))
"Inner section of O"
penup()
left(135)
forward(unit*3)
right(90)
pendown()
forward(unit*2)
left(90)
forward(unit*2)
left(90)
forward(unit*2)
left(90)
forward(unit*2)
"Back to start"
penup()
right(90)
forward(unit*3)
left(90)
forward(unit*3)
left(90)
def draw_letter_p(unit):
penup()
forward(unit*1)
pendown()
"Draw bottom and right side of stem"
forward(unit*2)
left(90)
forward(unit*2)
"Right and top section of P"
right(90)
forward(unit*2)
left(45)
forward(unit * 2 * sqrt(2))
left(45)
forward(unit*2)
left(45)
forward(unit * 2 * sqrt(2))
left(45)
forward(unit*4)
"Left section of stem to bottom"
left(90)
forward(unit*8)
"Inner section of P"
penup()
left(180)
forward(unit*4)
right(90)
forward(unit*2)
pendown()
forward(unit*2)
left(90)
forward(unit*2)
left(90)
forward(unit*2)
left(90)
forward(unit*2)
"Pen Back to the beginning"
penup()
right(90)
forward(unit*3)
left(90)
forward(unit*4)
left(90)
def draw_letter_q(unit):
pass
def draw_letter_r(unit):
penup()
forward(unit*1)
pendown()
"1st & 2nd stem sections of R"
forward(unit*2)
left(90)
forward(unit*3)
right(90)
forward(unit*2)
right(90)
forward(unit*3)
left(90)
forward(unit*2)
left(90)
forward(unit*3)
"Angled right sections of R"
left(45)
forward(unit * 1 * sqrt(2))
right(90)
forward(unit * 1 * sqrt(2))
left(45)
forward(unit*2)
left(45)
forward(unit * 1 * sqrt(2))
left(45)
"Top and left stem of R"
forward(unit*5)
left(90)
forward(unit*8)
"Inner section of R"
penup()
left(180)
forward(unit*4)
right(90)
forward(unit*2)
pendown()
forward(unit*2)
left(90)
forward(unit*2)
left(90)
forward(unit*2)
left(90)
forward(unit*2)
"Back to beginning"
penup()
right(90)
forward(unit*3)
left(90)
forward(unit*4)
left(90)
def draw_letter_s(unit):
pass
def draw_letter_t(unit):
penup()
forward(unit*3)
pendown()
# right side of stem section
forward(unit*2)
left(90)
forward(unit*6)
# Arm (top) section
right(90)
forward(unit*2)
left(90)
forward(unit*2)
left(90)
forward(unit*6)
left(90)
forward(unit*2)
left(90)
forward(unit*2)
#left side of stem, moving down to start
right(90)
forward(unit*6)
# Start position
left(90)
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