generated from mwc/lab_names
39 lines
596 B
Python
39 lines
596 B
Python
# shapes.py
|
|
# ---------
|
|
# By MWC contributors
|
|
|
|
from turtle import forward, right, left, penup, pendown, goto
|
|
|
|
def triangle(side_length):
|
|
forward(side_length)
|
|
right(120)
|
|
forward(side_length)
|
|
right(120)
|
|
forward(side_length)
|
|
left(120)
|
|
|
|
def rectangle(height, width):
|
|
forward(width)
|
|
right(90)
|
|
forward(height)
|
|
right(90)
|
|
forward(width)
|
|
right(90)
|
|
forward(height)
|
|
right(90)
|
|
|
|
def flyto(x, y):
|
|
penup()
|
|
goto(x, y)
|
|
pendown
|
|
|
|
flyto(-100, 0)
|
|
rectangle(2, 4)
|
|
rectangle(4, 8)
|
|
rectangle(8, 16)
|
|
flyto(100,0)
|
|
triangle(10)
|
|
triangle(20)
|
|
triangle(30)
|
|
|