Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_wavy_wireframe2.py
- import math
- import time
- from Tkinter import *
- import random
- root = Tk()
- width,height=680,680
- root.geometry("%dx%d+-10+0"%(width,height))
- canvas = Canvas(root,width=width, height=height, background="grey" )
- canvas.grid()
- m = 20
- n = 20
- p = 30
- color = 'blue'
- px = 50
- py = 50
- k = 0
- angles = 360.0 / (m*n)
- spots = []
- lines = []
- for i in range(m):
- xx = []
- yy = []
- v = k/20
- for j in range(n):
- x = px+(i*p)
- y = py+(j*p)
- spots += [[k,x,y]]
- xx.append(k)
- yy.append(v)
- k += 1
- v += 20
- lines.extend([xx,yy])
- 0
- amount = len(spots)
- speeds = [(i*0.025) for i in range(amount+1)]
- while 1:
- canvas.delete('all')
- plot = []
- for i in range(amount):
- j,x,y = spots[i]
- k = (j+1-(speeds[i]))%amount
- spots[i] = [k,x,y]
- angle = j * angles
- u = ((amount-i)*0.04) * math.sin(angle*math.pi/180)
- v = ((amount-i)*0.03) * math.cos(angle*math.pi/180)
- x += u
- y += v
- u = (i*0.04) * math.sin(angle*math.pi/180)
- v = (i*0.03) * math.cos(angle*math.pi/180)
- x += u
- y += v
- plot += [(x,y)]
- for line in lines:
- p = [plot[i] for i in line]
- canvas.create_line(p, fill=color)
- canvas.update()
- 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement