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()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user