Kathryn Odell-Hamilton

I created a program with in a grid layout of drawing varying weight and
length of lines horizontal and vertical with one filled square and
two filled rectangleswith 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 could I 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 cordinates to draw multiple squares and rectanges that
are adjacent to each other with different color fills.
Also, I want to learn how to draw lines from edge to edge of the screen,
vertically and horizontally.

- My idea for a future project would be to create a more complex
version of a Mondrian layout such as
Composition with Large Red Plane, Yellow, Black, Gray, and Blue, 1921 or
Broadway Boogie-Woogie, 1926.
This commit is contained in:
kathrynoh23 2023-08-17 22:03:48 -04:00
parent 9f5354c7d3
commit f235bcf0e9
10 changed files with 446 additions and 42 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

21
animated_square.py Normal file
View File

@ -0,0 +1,21 @@
from superturtle.animation import animate
from turtle import *
from turtle import forward, right
begin_fill()
def square(side_length):
fillcolor('blue')
begin_fill()
for side in range(4):
forward(side_length)
right(90)
for frame in animate(40, loop=True):
size = frame.interpolate(50, 100, mirror=True)
square(size)
end_fill()

View File

@ -1,7 +1,188 @@
# drawing.py
# ----------
# By ____(you)___________
# By Kathryn Odell-Hamilton
#
# (Briefly describe what this program does.)
"""The program will create a grid of draw black varying weight lines horizontally and vertically fully and partially
across to create one fill square and two fill rectangles in a Piet Mondrian abstract artistic style. Within the layout
a few shapes (squares and rectangles) will be drawn and filled with primary colors, red, blue, yellow.
"""
from turtle import *
screensize(500, 500)
speed(9)
# Positioning pen in upper left of screen
penup()
setposition(-200, 200)
# Pen color and size
pendown()
# pen color and size
pencolor("black")
pensize(2)
# Drawing a square
def square(side_length):
for side in range(4):
forward(side_length)
right(90)
sizes = [400]
for size in sizes:
square(size)
penup()
# Move down on left side
right(90)
forward(170)
left(90)
# Drawing horizontal lines
forward(2)
pencolor("black")
pensize(6)
pendown()
forward(396)
#Return to left side and down
penup()
left(180)
forward(397)
# Move down on left side
left(90)
forward(90)
left(90)
# Drawing horizontal lines
forward(1)
pendown()
forward(396)
#Return to left side and down
penup()
left(180)
forward(397)
# Move down on left side
left(90)
forward(130)
left(90)
# Drawing horizontal lines
forward(-1)
pendown()
pensize(3)
forward(398)
#Return to left side and down
penup()
left(180)
forward(400)
# draw vertical line from 2nd horizontal line
pensize(3.5)
right(90)
forward(130)
right(90)
forward(50)
right(90)
pendown()
forward(130)
# Move up to top position to draw vertical line
penup()
left(180)
forward(388)
right(90)
forward(140)
right(90)
# Draw 2nd vertical line from top to bottom line
pendown()
pensize(4)
forward(387)
# Draw 3rd vertical line from 2nd horizontal line to bottom line
penup()
left(180)
forward(128)
right(90)
# Drawing a blue square
pendown()
fillcolor('blue')
begin_fill()
def square(side_length):
for side in range(4):
forward(side_length)
right(90)
sizes = [105]
for size in sizes:
square(size)
end_fill()
#3rd vertical line
penup()
forward(105)
right(90)
pendown()
forward(128)
left(90)
#Penup moving to fill in yellow rectangle
penup()
left(180)
forward(292)
right(90)
fillcolor('yellow')
begin_fill()
for side in range(2):
forward(126)
right(90)
forward(45)
right(90)
end_fill()
# Fill top left rectangle red
penup()
forward(388)
right(90)
fillcolor('red')
begin_fill()
for side in range(2):
forward(185)
right(90)
forward(166)
right(90)
end_fill()
# Go back to beginning, top left
penup()
pencolor('black')
setposition(-200, 200)
"""hide and show turtle to make sure lines are butting to each other"""
hideturtle()
done()

9
drawing_fly.py Normal file
View File

@ -0,0 +1,9 @@
from turtle import *
def fly(distance):
"Moves without drawing."
penup()
left(180)
forward(distance)
pendown()

97
poetry.lock generated
View File

@ -42,13 +42,13 @@ lxml = ["lxml"]
[[package]]
name = "certifi"
version = "2023.5.7"
version = "2023.7.22"
description = "Python package for providing Mozilla's CA Bundle."
optional = false
python-versions = ">=3.6"
files = [
{file = "certifi-2023.5.7-py3-none-any.whl", hash = "sha256:c6c2e98f5c7869efca1f8916fed228dd91539f9f1b444c314c06eef02980c716"},
{file = "certifi-2023.5.7.tar.gz", hash = "sha256:0f0d56dc5a6ad56fd4ba36484d6cc34451e1c6548c61daad8c320169f91eddc7"},
{file = "certifi-2023.7.22-py3-none-any.whl", hash = "sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9"},
{file = "certifi-2023.7.22.tar.gz", hash = "sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082"},
]
[[package]]
@ -159,13 +159,13 @@ files = [
[[package]]
name = "furo"
version = "2023.5.20"
version = "2023.8.17"
description = "A clean customisable Sphinx documentation theme."
optional = false
python-versions = ">=3.7"
files = [
{file = "furo-2023.5.20-py3-none-any.whl", hash = "sha256:594a8436ddfe0c071f3a9e9a209c314a219d8341f3f1af33fdf7c69544fab9e6"},
{file = "furo-2023.5.20.tar.gz", hash = "sha256:40e09fa17c6f4b22419d122e933089226dcdb59747b5b6c79363089827dea16f"},
{file = "furo-2023.8.17-py3-none-any.whl", hash = "sha256:baed406fc8f75a585caa330756b6841e6a1d4c844a3a355387e01ba9d1a4c6ee"},
{file = "furo-2023.8.17.tar.gz", hash = "sha256:56664be7290d1457a49d6c2c98cbf96537b9ee1cf05d28e05a5178e76abe5c55"},
]
[package.dependencies]
@ -285,13 +285,13 @@ files = [
[[package]]
name = "pygments"
version = "2.15.1"
version = "2.16.1"
description = "Pygments is a syntax highlighting package written in Python."
optional = false
python-versions = ">=3.7"
files = [
{file = "Pygments-2.15.1-py3-none-any.whl", hash = "sha256:db2db3deb4b4179f399a09054b023b6a586b76499d36965813c71aa8ed7b5fd1"},
{file = "Pygments-2.15.1.tar.gz", hash = "sha256:8ace4d3c1dd481894b2005f560ead0f9f19ee64fe983366be1a21e171d12775c"},
{file = "Pygments-2.16.1-py3-none-any.whl", hash = "sha256:13fc09fa63bc8d8671a6d247e1eb303c4b343eaee81d861f3404db2935653692"},
{file = "Pygments-2.16.1.tar.gz", hash = "sha256:1daff0494820c69bc8941e407aa20f577374ee88364ee10a98fdbe0aece96e29"},
]
[package.extras]
@ -342,13 +342,13 @@ files = [
[[package]]
name = "sphinx"
version = "7.0.1"
version = "7.2.2"
description = "Python documentation generator"
optional = false
python-versions = ">=3.8"
python-versions = ">=3.9"
files = [
{file = "Sphinx-7.0.1.tar.gz", hash = "sha256:61e025f788c5977d9412587e733733a289e2b9fdc2fef8868ddfbfc4ccfe881d"},
{file = "sphinx-7.0.1-py3-none-any.whl", hash = "sha256:60c5e04756c1709a98845ed27a2eed7a556af3993afb66e77fec48189f742616"},
{file = "sphinx-7.2.2-py3-none-any.whl", hash = "sha256:ed33bc597dd8f05cd37118f64cbac0b8bf773389a628ddfe95ab9e915c9308dc"},
{file = "sphinx-7.2.2.tar.gz", hash = "sha256:1c0abe6d4de7a6b2c2b109a2e18387bf27b240742e1b34ea42ac3ed2ac99978c"},
]
[package.dependencies]
@ -359,7 +359,7 @@ docutils = ">=0.18.1,<0.21"
imagesize = ">=1.3"
Jinja2 = ">=3.0"
packaging = ">=21.0"
Pygments = ">=2.13"
Pygments = ">=2.14"
requests = ">=2.25.0"
snowballstemmer = ">=2.0"
sphinxcontrib-applehelp = "*"
@ -372,7 +372,7 @@ sphinxcontrib-serializinghtml = ">=1.1.5"
[package.extras]
docs = ["sphinxcontrib-websupport"]
lint = ["docutils-stubs", "flake8 (>=3.5.0)", "flake8-simplify", "isort", "mypy (>=0.990)", "ruff", "sphinx-lint", "types-requests"]
test = ["cython", "filelock", "html5lib", "pytest (>=4.6)"]
test = ["cython (>=3.0)", "filelock", "html5lib", "pytest (>=4.6)", "setuptools (>=67.0)"]
[[package]]
name = "sphinx-basic-ng"
@ -393,45 +393,54 @@ docs = ["furo", "ipython", "myst-parser", "sphinx-copybutton", "sphinx-inline-ta
[[package]]
name = "sphinxcontrib-applehelp"
version = "1.0.4"
version = "1.0.7"
description = "sphinxcontrib-applehelp is a Sphinx extension which outputs Apple help books"
optional = false
python-versions = ">=3.8"
python-versions = ">=3.9"
files = [
{file = "sphinxcontrib-applehelp-1.0.4.tar.gz", hash = "sha256:828f867945bbe39817c210a1abfd1bc4895c8b73fcaade56d45357a348a07d7e"},
{file = "sphinxcontrib_applehelp-1.0.4-py3-none-any.whl", hash = "sha256:29d341f67fb0f6f586b23ad80e072c8e6ad0b48417db2bde114a4c9746feb228"},
{file = "sphinxcontrib_applehelp-1.0.7-py3-none-any.whl", hash = "sha256:094c4d56209d1734e7d252f6e0b3ccc090bd52ee56807a5d9315b19c122ab15d"},
{file = "sphinxcontrib_applehelp-1.0.7.tar.gz", hash = "sha256:39fdc8d762d33b01a7d8f026a3b7d71563ea3b72787d5f00ad8465bd9d6dfbfa"},
]
[package.dependencies]
Sphinx = ">=5"
[package.extras]
lint = ["docutils-stubs", "flake8", "mypy"]
test = ["pytest"]
[[package]]
name = "sphinxcontrib-devhelp"
version = "1.0.2"
description = "sphinxcontrib-devhelp is a sphinx extension which outputs Devhelp document."
version = "1.0.5"
description = "sphinxcontrib-devhelp is a sphinx extension which outputs Devhelp documents"
optional = false
python-versions = ">=3.5"
python-versions = ">=3.9"
files = [
{file = "sphinxcontrib-devhelp-1.0.2.tar.gz", hash = "sha256:ff7f1afa7b9642e7060379360a67e9c41e8f3121f2ce9164266f61b9f4b338e4"},
{file = "sphinxcontrib_devhelp-1.0.2-py2.py3-none-any.whl", hash = "sha256:8165223f9a335cc1af7ffe1ed31d2871f325254c0423bc0c4c7cd1c1e4734a2e"},
{file = "sphinxcontrib_devhelp-1.0.5-py3-none-any.whl", hash = "sha256:fe8009aed765188f08fcaadbb3ea0d90ce8ae2d76710b7e29ea7d047177dae2f"},
{file = "sphinxcontrib_devhelp-1.0.5.tar.gz", hash = "sha256:63b41e0d38207ca40ebbeabcf4d8e51f76c03e78cd61abe118cf4435c73d4212"},
]
[package.dependencies]
Sphinx = ">=5"
[package.extras]
lint = ["docutils-stubs", "flake8", "mypy"]
test = ["pytest"]
[[package]]
name = "sphinxcontrib-htmlhelp"
version = "2.0.1"
version = "2.0.4"
description = "sphinxcontrib-htmlhelp is a sphinx extension which renders HTML help files"
optional = false
python-versions = ">=3.8"
python-versions = ">=3.9"
files = [
{file = "sphinxcontrib-htmlhelp-2.0.1.tar.gz", hash = "sha256:0cbdd302815330058422b98a113195c9249825d681e18f11e8b1f78a2f11efff"},
{file = "sphinxcontrib_htmlhelp-2.0.1-py3-none-any.whl", hash = "sha256:c38cb46dccf316c79de6e5515e1770414b797162b23cd3d06e67020e1d2a6903"},
{file = "sphinxcontrib_htmlhelp-2.0.4-py3-none-any.whl", hash = "sha256:8001661c077a73c29beaf4a79968d0726103c5605e27db92b9ebed8bab1359e9"},
{file = "sphinxcontrib_htmlhelp-2.0.4.tar.gz", hash = "sha256:6c26a118a05b76000738429b724a0568dbde5b72391a688577da08f11891092a"},
]
[package.dependencies]
Sphinx = ">=5"
[package.extras]
lint = ["docutils-stubs", "flake8", "mypy"]
test = ["html5lib", "pytest"]
@ -452,30 +461,36 @@ test = ["flake8", "mypy", "pytest"]
[[package]]
name = "sphinxcontrib-qthelp"
version = "1.0.3"
description = "sphinxcontrib-qthelp is a sphinx extension which outputs QtHelp document."
version = "1.0.6"
description = "sphinxcontrib-qthelp is a sphinx extension which outputs QtHelp documents"
optional = false
python-versions = ">=3.5"
python-versions = ">=3.9"
files = [
{file = "sphinxcontrib-qthelp-1.0.3.tar.gz", hash = "sha256:4c33767ee058b70dba89a6fc5c1892c0d57a54be67ddd3e7875a18d14cba5a72"},
{file = "sphinxcontrib_qthelp-1.0.3-py2.py3-none-any.whl", hash = "sha256:bd9fc24bcb748a8d51fd4ecaade681350aa63009a347a8c14e637895444dfab6"},
{file = "sphinxcontrib_qthelp-1.0.6-py3-none-any.whl", hash = "sha256:bf76886ee7470b934e363da7a954ea2825650013d367728588732c7350f49ea4"},
{file = "sphinxcontrib_qthelp-1.0.6.tar.gz", hash = "sha256:62b9d1a186ab7f5ee3356d906f648cacb7a6bdb94d201ee7adf26db55092982d"},
]
[package.dependencies]
Sphinx = ">=5"
[package.extras]
lint = ["docutils-stubs", "flake8", "mypy"]
test = ["pytest"]
[[package]]
name = "sphinxcontrib-serializinghtml"
version = "1.1.5"
description = "sphinxcontrib-serializinghtml is a sphinx extension which outputs \"serialized\" HTML files (json and pickle)."
version = "1.1.8"
description = "sphinxcontrib-serializinghtml is a sphinx extension which outputs \"serialized\" HTML files (json and pickle)"
optional = false
python-versions = ">=3.5"
python-versions = ">=3.9"
files = [
{file = "sphinxcontrib-serializinghtml-1.1.5.tar.gz", hash = "sha256:aa5f6de5dfdf809ef505c4895e51ef5c9eac17d0f287933eb49ec495280b6952"},
{file = "sphinxcontrib_serializinghtml-1.1.5-py2.py3-none-any.whl", hash = "sha256:352a9a00ae864471d3a7ead8d7d79f5fc0b57e8b3f95e9867eb9eb28999b92fd"},
{file = "sphinxcontrib_serializinghtml-1.1.8-py3-none-any.whl", hash = "sha256:27849e7227277333d3d32f17c138ee148a51fa01f888a41cd6d4e73bcabe2d06"},
{file = "sphinxcontrib_serializinghtml-1.1.8.tar.gz", hash = "sha256:aaf3026335146e688fd209b72320314b1b278320cf232e3cda198f873838511a"},
]
[package.dependencies]
Sphinx = ">=5"
[package.extras]
lint = ["docutils-stubs", "flake8", "mypy"]
test = ["pytest"]
@ -497,13 +512,13 @@ sphinx = ">=7.0.1,<8.0.0"
[[package]]
name = "urllib3"
version = "2.0.3"
version = "2.0.4"
description = "HTTP library with thread-safe connection pooling, file post, and more."
optional = false
python-versions = ">=3.7"
files = [
{file = "urllib3-2.0.3-py3-none-any.whl", hash = "sha256:48e7fafa40319d358848e1bc6809b208340fafe2096f1725d05d67443d0483d1"},
{file = "urllib3-2.0.3.tar.gz", hash = "sha256:bee28b5e56addb8226c96f7f13ac28cb4c301dd5ea8a6ca179c0b9835e032825"},
{file = "urllib3-2.0.4-py3-none-any.whl", hash = "sha256:de7df1803967d2c2a98e4b11bb7d6bd9210474c46e8a0401514e3a42a75ebde4"},
{file = "urllib3-2.0.4.tar.gz", hash = "sha256:8d22f86aae8ef5e410d4f539fde9ce6b2113a001bb4d189e0aed70642d602b11"},
]
[package.extras]

178
testing.py Normal file
View File

@ -0,0 +1,178 @@
from turtle import *
screensize(500, 500)
speed(9)
# Positioning pen in upper left of screen
penup()
setposition(-200, 200)
# Pen color and size
pendown()
# pen color and size
pencolor("black")
pensize(2)
# Drawing a square
def square(side_length):
for side in range(4):
forward(side_length)
right(90)
sizes = [400]
for size in sizes:
square(size)
penup()
# Move down on left side
right(90)
forward(170)
left(90)
# Drawing horizontal lines
forward(2)
pencolor("black")
pensize(6)
pendown()
forward(396)
#Return to left side and down
penup()
left(180)
forward(397)
# Move down on left side
left(90)
forward(90)
left(90)
# Drawing horizontal lines
forward(1)
pendown()
forward(396)
#Return to left side and down
penup()
left(180)
forward(397)
# Move down on left side
left(90)
forward(130)
left(90)
# Drawing horizontal lines
forward(-1)
pendown()
pensize(3)
forward(398)
#Return to left side and down
penup()
left(180)
forward(400)
# draw vertical line from 2nd horizontal line
pensize(3.5)
right(90)
forward(130)
right(90)
forward(50)
right(90)
pendown()
forward(130)
# Move up to top position to draw vertical line
penup()
left(180)
forward(388)
right(90)
forward(140)
right(90)
# Draw 2nd vertical line from top to bottom line
pendown()
pensize(4)
forward(387)
# Draw 3rd vertical line from 2nd horizontal line to bottom line
penup()
left(180)
forward(128)
right(90)
# Drawing a blue square
pendown()
fillcolor('blue')
begin_fill()
def square(side_length):
for side in range(4):
forward(side_length)
right(90)
sizes = [105]
for size in sizes:
square(size)
end_fill()
#3rd vertical line
penup()
forward(105)
right(90)
pendown()
forward(128)
left(90)
#Penup moving to fill in yellow rectangle
penup()
left(180)
forward(292)
right(90)
fillcolor('yellow')
begin_fill()
for side in range(2):
forward(126)
right(90)
forward(45)
right(90)
end_fill()
# Fill top left rectangle red
penup()
forward(388)
right(90)
fillcolor('red')
begin_fill()
for side in range(2):
forward(185)
right(90)
forward(166)
right(90)
end_fill()
# Go back to beginning, top left
penup()
pencolor('black')
setposition(-200, 200)
"""hide and show turtle to make sure lines are butting to each other"""
hideturtle()
done()