lab_iteration/tile.py

41 lines
893 B
Python

from turtle import *
def draw_tile(size):
"Draws one tile, which can be repeated to form a pattern."
draw_tile_outline(size)
draw_greater_arc(size)
def draw_tile_outline(size):
pencolor("#dddddd")
square(size)
def fly(distance):
"Moves without drawing."
penup()
forward(distance)
pendown()
def square(size):
"Draws a square of side length `size`"
for side in range(4):
forward(size)
left(90)
def quarter_arc_right(radius):
"Draws a quarter of an arc, turning to the right."
circle(-radius, 90)
def quarter_arc_left(radius):
"Draws a quarter of an arc, turning to the left."
circle(radius, 90)
def draw_greater_arc(size):
"Draw a full arc or half of a circle, turning to the left."
pencolor("black")
quarter_arc_left(size/2)
quarter_arc_left(size/2)
left(90)
fly(size)
left(90)