Skip to content

Instantly share code, notes, and snippets.

@royalPanic
Last active May 4, 2019 05:41
Show Gist options
  • Save royalPanic/3da768b61bd33334be029c932d4e887a to your computer and use it in GitHub Desktop.
Save royalPanic/3da768b61bd33334be029c932d4e887a to your computer and use it in GitHub Desktop.
A very quick script that makes you a 600x600px grid with turtle in python.

/u/humanpabo, I got you!

#imports
import turtle as t
#var defs
w = t.Screen()
g = t.Turtle()
x = -300
y = -300
#turtle config
w.title("Snake")
w.bgcolor("White")
w.setup(width=600, height=600)
w.tracer(0)
g.speed(1)
g.hideturtle()
#function defs
def verticalLine(x):
    g.penup()
    g.goto(x,300)
    g.pendown()
    g.goto(x,-300)
def horizontalLine(y):
    g.penup()
    g.goto(-300,y)
    g.pendown()
    g.goto(300,y)
# the loop to make the vertical lines
while x < 320:
    verticalLine(x)
    x += 20
g.hideturtle()
while y < 340:
    horizontalLine(y)
    y += 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment