Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from Tkinter import *
- from math import sin, cos
- width = 640
- height = 480
- w = Canvas(Tk(), width=width, height=height)
- w.pack()
- t = 0.0
- step = 1
- a = 10.5
- b = 11
- def pos(t):
- x = width/2 + (width * sin( t/a )) * 0.49
- y = height/2 + (height * cos( t/b )) * 0.49
- return x, y
- def draw(t):
- p1, p2 = pos(t), pos(t + step)
- w.create_line(p1[0], p1[1], p2[0], p2[1])
- while 1:
- draw(t)
- t += step
- w.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement