generated from mwc/lab_turtle
I modified the code to draw a green heart with a
pink arrow going through it. This process included tasks such as roation, color changes and using the penup/pendown commands. At first I felt a bit frustrated because I couldm't really figure out the UI, since I used Python only in Jupyter Notebook before. I also felt confused when I was trying to figure out the initial oritentation of the "pen". Once I figured that out, it was smooth sailing. It felt funny to need geometry after a long time not needing it. Once I was done, I felt happy!
This commit is contained in:
41
drawing.py
41
drawing.py
@@ -1,3 +1,4 @@
|
||||
import math
|
||||
from turtle import (
|
||||
forward,
|
||||
back,
|
||||
@@ -8,15 +9,43 @@ from turtle import (
|
||||
color,
|
||||
)
|
||||
|
||||
color("PaleGreen")
|
||||
right(315)
|
||||
forward(300)
|
||||
left(45)
|
||||
forward(100)
|
||||
right(360 * 2 / 5)
|
||||
left(45)
|
||||
forward(100)
|
||||
right(360 * 2 / 5)
|
||||
left(45)
|
||||
forward(100)
|
||||
right(360 * 2 / 5)
|
||||
left(45)
|
||||
forward(100)
|
||||
right(360 * 2 / 5)
|
||||
right(90)
|
||||
forward(100)
|
||||
right(360 * 2 / 5)
|
||||
|
||||
left(45)
|
||||
forward(100)
|
||||
left(45)
|
||||
forward(100)
|
||||
left(45)
|
||||
forward(100)
|
||||
left(45)
|
||||
forward(300)
|
||||
left(45)
|
||||
forward(60)
|
||||
penup()
|
||||
back(300/(math.sqrt(2)))
|
||||
color("DeepPink")
|
||||
pendown()
|
||||
right(135)
|
||||
back(600)
|
||||
right(90)
|
||||
forward(5)
|
||||
right(135)
|
||||
forward(5*(math.sqrt(2)))
|
||||
right(90)
|
||||
forward(5*(math.sqrt(2)))
|
||||
right(135)
|
||||
forward(5)
|
||||
input()
|
||||
|
||||
|
||||
|
||||
7
poetry.lock
generated
Normal file
7
poetry.lock
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Poetry 2.1.4 and should not be changed by hand.
|
||||
package = []
|
||||
|
||||
[metadata]
|
||||
lock-version = "2.1"
|
||||
python-versions = ">=3.10,<4.0"
|
||||
content-hash = "7b8fc01b274bd807fb00372bbc8e138330f15ae7978ed61e180f3b17ec076725"
|
||||
Reference in New Issue
Block a user