Skip to content

Commit 7e38d2a

Browse files
committed
Added drawBar
Made the turtle draw the silhouette RELEASE V0.1
1 parent 824b632 commit 7e38d2a

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

main.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@
1212

1313
def main():
1414
""" Main program function, Draws silhouette"""
15+
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,
16+
20, 0, 20, 22, 24, 0, 0, 8, 8, 7, 8, 7, 10, 12]
1517
charles = turtle.Turtle()
1618
screen = charles.screen
1719
charles.penup()
1820
charles.goto(-screen.window_width() / 2, -screen.window_height() / 2)
1921
charles.setheading(0)
2022
charles.pendown()
2123
charles.speed(1000)
22-
for i in range(units.wu2px(screen, 45)):
23-
draw_peak(charles, units.vu2px(screen, 10))
24+
for h in template:
25+
draw_bar_u(screen, charles, 1, h)
2426
turtle.done()
2527

2628

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

3739

40+
def draw_bar_u(screen, drawer, width, height):
41+
for i in range(units.wu2px(screen, width)):
42+
draw_peak(drawer, units.vu2px(screen, height))
43+
44+
3845
if __name__ == "__main__":
3946
main()

units.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

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

1414

1515
def wu2px(screen, units):

0 commit comments

Comments
 (0)