Skip to content

Instantly share code, notes, and snippets.

@mbround18
Created August 6, 2018 04:59
Show Gist options
  • Save mbround18/71b9ff9e7408fbaf4579c4b9ed40c1c2 to your computer and use it in GitHub Desktop.
Save mbround18/71b9ff9e7408fbaf4579c4b9ed40c1c2 to your computer and use it in GitHub Desktop.
# Define a function to draw and fill an equalateral right
# triangle with the given hypotenuse length and color. This
# is used to create a roof shape.
def drawTriangle(t, length, color):
t.fillcolor(color)
t.begin_fill()
t.forward(length)
t.left(135)
t.forward(length / math.sqrt(2))
t.left(90)
t.forward(length / math.sqrt(2))
t.left(135)
t.end_fill()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment