Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_rnd_multiplier_patterns_2.py
- import math
- import time
- from Tkinter import *
- import random
- root = Tk()
- width,height=600,600
- canvas = Canvas(root,width=width, height=height, background="grey" )
- canvas.pack()
- def drawCircle():
- points = []
- points2 = []
- canvas.delete('all')
- angleBetweenPoints = 360.0 / number_of_points
- for i in range(number_of_points):
- angle = i * angleBetweenPoints
- a = x + outerradius * math.sin(angle*math.pi/180)
- b = y + outerradius * math.cos(angle*math.pi/180)
- aaa = x + innerradius * math.sin(angle*math.pi/180)
- bbb = y + innerradius * math.cos(angle*math.pi/180)
- points.append([a+10, b+10])
- points2.append([aaa+10, bbb+10])
- if points:
- for i in range(len(points)):
- x1,y1 = points[i]
- x2,y2 = points2[i*multiplier % len(points)]
- canvas.create_line(x1,y1,x2,y2)
- canvas.update()
- x = 280
- y = 280
- outerradius = 275
- innerradius = 225
- points = []
- points2 = []
- wait = 0
- while 1:
- number_of_points = random.randint(60,360)
- multiplier = random.randint(2,number_of_points-1)
- drawCircle()
- print number_of_points, multiplier
- wait = time.time()+0.6
- while time.time() < wait:
- 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement