Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # t_wave_overlays.py
- import wave
- import math
- from turtle import Turtle, Screen
- from itertools import cycle
- COLORS = cycle(['red', 'blue', 'green', 'purple', 'yellow'])
- def draw_wave():
- turtle.penup()
- turtle.color(next(COLORS))
- for x in range(20,100):
- y_val = amp * math.sin(math.radians(x * freq))
- turtle.goto(x-10, y_val)
- turtle.pendown()
- screen = Screen()
- screen.bgcolor('lightyellow')
- screen.setworldcoordinates(0, -400, 100, 400)
- screen.setup(600, 600)
- turtle = Turtle('turtle')
- turtle.hideturtle()
- turtle.speed('fastest')
- turtle.width(2)
- amp = 360
- while 1:
- freq_list = []
- for freq in range(1,200):
- freq_list.append(freq)
- print(('\nAmp = '+str(amp)+' '*16)[:16]+'Freq = '+str(freq))
- draw_wave()
- amp -= 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement