From 40fc8fc64077c660bced823dfec57278633da733 Mon Sep 17 00:00:00 2001 From: kdang Date: Thu, 16 Oct 2025 09:25:52 -0400 Subject: [PATCH] I was able to save the drawing as an svg file. --- drawing.py | 25 ++++++++++++++++--------- drawing.svg | 2 ++ 2 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 drawing.svg diff --git a/drawing.py b/drawing.py index 1c25ed8..610fb77 100644 --- a/drawing.py +++ b/drawing.py @@ -6,6 +6,8 @@ from turtle import * from math import sqrt +from superturtle.image import save_svg +from superturtle.movement import no_delay def fly(distance): "The turtle moves without drawing for a specified distance." @@ -56,7 +58,7 @@ def rotateleft(): def drawright(): "The turtle draws squares to the right." - for i in range(5): + for i in range(10): pattern() left(135) fly(85) @@ -64,7 +66,7 @@ def drawright(): def drawleft(): "The turtle draws squares to the left." - for i in range(5): + for i in range(10): pattern() right(45) fly(57) @@ -76,12 +78,17 @@ def draw(): drawleft() rotateleft() -"The turtle starts at a specific point and facing a specific direction, then performs the draw function." -penup() -goto(-180,180) -pendown() -left(180) -for i in range(3): - draw() +def draw_my_drawing(): + "The turtle starts at a specific point and facing a specific direction, then performs the draw function." + penup() + goto(-320,450) + pendown() + left(180) + for i in range(7): + draw() + +width, height = 816, 1056 +with save_svg(width, height, "drawing.svg"): + draw_my_drawing() input() \ No newline at end of file diff --git a/drawing.svg b/drawing.svg new file mode 100644 index 0000000..1684db1 --- /dev/null +++ b/drawing.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file