Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_wavy_wireframe.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 = 10
- n = 10
- d = 20
- r = 20
- p = 60
- color = 'blue'
- px = 50
- py = 50
- k = 0
- angles = 360.0 / (m*n)
- spots = []
- lines = []
- for i in range(m):
- xx = []
- yy = []
- v = k/10
- 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 += 10
- lines.extend([xx,yy])
- 0
- amount = len(spots)
- while 1:
- canvas.delete('all')
- plot = []
- for i in range(amount):
- j,x,y = spots[i]
- angle = j * angles
- u = r * math.sin(angle*math.pi/180)
- v = r * math.cos(angle*math.pi/180)
- k = (j+1-(i*0.03))%amount
- spots[i] = [k,x,y]
- 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