From c82a594a05db8dd3e9f1f0670a7f408a64317ce5 Mon Sep 17 00:00:00 2001 From: Hope Date: Mon, 23 Jun 2025 13:11:08 -0400 Subject: [PATCH] I started my drawing project by writting a function to draw the turtle accepting a size parameter. I found it helpful to use graph paper and draw out my steps. --- drawing.py | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- test.py | 8 ++++++++ 2 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 test.py diff --git a/drawing.py b/drawing.py index 29fc89e..5e1cc33 100644 --- a/drawing.py +++ b/drawing.py @@ -1,7 +1,61 @@ # drawing.py # ---------- -# By ____(you)___________ +# By Hope Wright # -# (Briefly describe what this program does.) +# a turtle and bubbles will be drawn and animate swimming across the screen +# phase 2 would be to have it start smaller and grow is it swims across the screen to look like it's getting closer +# phase 3 would be to animate the bubbles. from turtle import * +from superturtle.movement import fly +from superturtle.animation import animate +import math + +def draw_turtle(size): + + + #draw an oval for the shell + height = size*2 + width = size*1.5 + + steps = 100 + for i in range(steps + 1): + angle = 2 * math.pi * i / steps + x = (width) * math.cos(angle) + y = (height) * math.sin(angle) + goto(x,y) + + #move to top of for head + + penup() + left(90) + forward(size*4) + left(90) + forward(size*1.5) + pendown() + + #draw a circle for the head + circle(size) + + #draw some lines on the shell + penup() + left(90) + forward(size*2) + pendown() + forward(size*4) + right(180) + forward(size*2) + left(90) + forward(size*1.5) + penup() + left(180) + forward(size*1.5) + pendown() + + + + + +draw_turtle(20) +done() + diff --git a/test.py b/test.py new file mode 100644 index 0000000..97f9c08 --- /dev/null +++ b/test.py @@ -0,0 +1,8 @@ +from turtle import forward, right +from superturtle.movement import restore_state_when_finished +for angle in range(0, 360, 15): + with restore_state_when_finished(): + right(angle) + forward(100) + +superturtle.image.save(spokes.jpg) \ No newline at end of file