generated from mwc/project_drawing
I was able to save the drawing as an svg file.
This commit is contained in:
25
drawing.py
25
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()
|
||||
2
drawing.svg
Normal file
2
drawing.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 136 KiB |
Reference in New Issue
Block a user