generated from mwc/project_drawing
I was able to save the drawing as an svg file.
This commit is contained in:
15
drawing.py
15
drawing.py
@@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
from turtle import *
|
from turtle import *
|
||||||
from math import sqrt
|
from math import sqrt
|
||||||
|
from superturtle.image import save_svg
|
||||||
|
from superturtle.movement import no_delay
|
||||||
|
|
||||||
def fly(distance):
|
def fly(distance):
|
||||||
"The turtle moves without drawing for a specified distance."
|
"The turtle moves without drawing for a specified distance."
|
||||||
@@ -56,7 +58,7 @@ def rotateleft():
|
|||||||
|
|
||||||
def drawright():
|
def drawright():
|
||||||
"The turtle draws squares to the right."
|
"The turtle draws squares to the right."
|
||||||
for i in range(5):
|
for i in range(10):
|
||||||
pattern()
|
pattern()
|
||||||
left(135)
|
left(135)
|
||||||
fly(85)
|
fly(85)
|
||||||
@@ -64,7 +66,7 @@ def drawright():
|
|||||||
|
|
||||||
def drawleft():
|
def drawleft():
|
||||||
"The turtle draws squares to the left."
|
"The turtle draws squares to the left."
|
||||||
for i in range(5):
|
for i in range(10):
|
||||||
pattern()
|
pattern()
|
||||||
right(45)
|
right(45)
|
||||||
fly(57)
|
fly(57)
|
||||||
@@ -76,12 +78,17 @@ def draw():
|
|||||||
drawleft()
|
drawleft()
|
||||||
rotateleft()
|
rotateleft()
|
||||||
|
|
||||||
|
def draw_my_drawing():
|
||||||
"The turtle starts at a specific point and facing a specific direction, then performs the draw function."
|
"The turtle starts at a specific point and facing a specific direction, then performs the draw function."
|
||||||
penup()
|
penup()
|
||||||
goto(-180,180)
|
goto(-320,450)
|
||||||
pendown()
|
pendown()
|
||||||
left(180)
|
left(180)
|
||||||
for i in range(3):
|
for i in range(7):
|
||||||
draw()
|
draw()
|
||||||
|
|
||||||
|
width, height = 816, 1056
|
||||||
|
with save_svg(width, height, "drawing.svg"):
|
||||||
|
draw_my_drawing()
|
||||||
|
|
||||||
input()
|
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