Created
February 12, 2021 01:44
-
-
Save brentxphillips/68bfb1ac0a45f09ec50b835188d3f70c to your computer and use it in GitHub Desktop.
Basic Turtle Graphics, Squares
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Brent Phillips | |
import turtle as t | |
def goto(x, y): | |
t.up() | |
t.goto(x, y) | |
t.down() | |
def box(move, turn, color="black", fill=False, scale=1): | |
t.color(color) | |
if fill: | |
t.begin_fill() | |
t.forward(move*scale) | |
t.right(turn) | |
t.forward(move*scale) | |
t.right(turn) | |
t.forward(move*scale) | |
t.right(turn) | |
t.forward(move*scale) | |
t.right(turn) | |
if fill: | |
t.end_fill() | |
goto(0, 0) | |
box(100, 90) | |
goto(-200, 0) | |
box(100, 90, "blue", True, 2) | |
t.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment