Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_rnd_multiplier_loverlap.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():
- canvas.delete('all')
- angleBetweenPoints = 360.0 / number_of_points
- for i in range(number_of_points):
- angle = i * angleBetweenPoints
- a = x + radius[0] * math.sin(angle*math.pi/180)
- b = y + radius[0] * math.cos(angle*math.pi/180)
- points.append([a+10, b+10])
- if points2:
- for i in range(len(points)):
- x1,y1 = points[i]
- x2,y2 = points[i*multiplier % len(points)]
- canvas.create_line(x1,y1,x2,y2)
- for i in range(len(points2)):
- x1,y1 = points2[i]
- x2,y2 = points2[i*multiplier % len(points2)]
- canvas.create_line(x1,y1,x2,y2)
- canvas.update()
- x = 280
- y = 280
- radius = [275,210]
- points2 = []
- wait = 0
- while 1:
- points = []
- number_of_points = random.randint(60,360)
- multiplier = random.randint(2,number_of_points-1)
- drawCircle()
- print number_of_points, multiplier
- if points2:
- wait = time.time()+0.6
- while time.time() < wait:
- 0
- points2 = points[:]
- radius += [radius.pop(0)]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement