Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_wavy_grid_patterns.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="yellow" )
- canvas.grid()
- m = 10
- n = 10
- d = 20
- r = 20
- p = 60
- color = 'blue'
- px = 50
- py = 50
- k = 1
- angles = 360.0 / (m*n)
- spots = []
- for i in range(m):
- for j in range(n):
- x = px+(i*p)
- y = py+(j*p)
- spots += [[k,x,y]]
- k += 1
- 0
- amount = len(spots)
- while 1:
- canvas.delete('all')
- 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
- canvas.create_oval(x, y, x+d, y+d, fill=color, outline=color)
- canvas.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement