Skip to content

Instantly share code, notes, and snippets.

@appcove
Last active December 18, 2015 21:24
Show Gist options
  • Save appcove/f93fa84b43218441783d to your computer and use it in GitHub Desktop.
Save appcove/f93fa84b43218441783d to your computer and use it in GitHub Desktop.
for x in range(-400,400,100):
for y in range(-400,400,100):
box(x,y,80,45)
import math
penup()
goto(-500,0)
pendown()
for x in range(-500,500,4):
y = math.sin(x/50) * 100
goto(x,y)
from turtle import *
speed(0)
hideturtle()
def box(x=None,y=None,size=100,angle=None):
penup()
if x is not None or y is not None:
goto(x,y)
if angle is not None:
setheading(angle)
pendown()
for i in range(4):
forward(size)
left(90)
penup()
def sweep(x,y,size,start,end,step):
for angle in range(start, end, step):
box(x,y,size,angle)
def diamond(x,y,size,step=3):
sweep(x,y,size,30,60,step)
#diamond(100,100,200,step=1)
# 4 different ways to call box
box()
box(100,100)
box(100,100,200)
box(100,100,200,45)
# more ways to call box with keywords
box(size=300)
box(size=300,angle=30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment