Skip to content

Commit

Permalink
Added drawBar
Browse files Browse the repository at this point in the history
Made the turtle draw the silhouette
RELEASE V0.1
  • Loading branch information
AAllport committed Aug 29, 2017
1 parent 824b632 commit 7e38d2a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@

def main():
""" Main program function, Draws silhouette"""
template = [10, 10, 0, 8, 8, 0, 20, 18, 25, 18, 20, 0, 10, 10, 10, 0, 21, 22, 24, 22, 21, 0, 12, 14, 12, 0, 18, 16,
20, 0, 20, 22, 24, 0, 0, 8, 8, 7, 8, 7, 10, 12]
charles = turtle.Turtle()
screen = charles.screen
charles.penup()
charles.goto(-screen.window_width() / 2, -screen.window_height() / 2)
charles.setheading(0)
charles.pendown()
charles.speed(1000)
for i in range(units.wu2px(screen, 45)):
draw_peak(charles, units.vu2px(screen, 10))
for h in template:
draw_bar_u(screen, charles, 1, h)
turtle.done()


Expand All @@ -35,5 +37,10 @@ def draw_peak(drawer, height):
drawer.left(90)


def draw_bar_u(screen, drawer, width, height):
for i in range(units.wu2px(screen, width)):
draw_peak(drawer, units.vu2px(screen, height))


if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion units.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

def vu2px(screen, units):
""" Returns the px's for a vertical unit (25ths of height)"""
return int((screen.window_height() / 50) * units)
return int((screen.window_height() / 25) * units)


def wu2px(screen, units):
Expand Down

0 comments on commit 7e38d2a

Please sign in to comment.