Skip to content

Commit 824b632

Browse files
committed
Created draw peak, contains some testing code
1 parent ba82132 commit 824b632

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

main.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"""
77

88
import turtle
9+
910
import units
1011

1112

@@ -17,10 +18,22 @@ def main():
1718
charles.goto(-screen.window_width() / 2, -screen.window_height() / 2)
1819
charles.setheading(0)
1920
charles.pendown()
20-
charles.speed(100)
21-
21+
charles.speed(1000)
22+
for i in range(units.wu2px(screen, 45)):
23+
draw_peak(charles, units.vu2px(screen, 10))
2224
turtle.done()
2325

2426

27+
def draw_peak(drawer, height):
28+
""" Draws a line with height """
29+
drawer.left(90)
30+
drawer.forward(height)
31+
drawer.right(90)
32+
drawer.forward(1)
33+
drawer.right(90)
34+
drawer.forward(height)
35+
drawer.left(90)
36+
37+
2538
if __name__ == "__main__":
2639
main()

units.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

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

1414

1515
def wu2px(screen, units):
1616
""" Returns the px's for a vertical unit (50ths of width)"""
17-
return (screen.window_width() / 50) * units
17+
return int((screen.window_width() / 50) * units)

0 commit comments

Comments
 (0)