Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_rnd_multiplier_patterns.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 = []
- canvas.delete('all')
- angleBetweenPoints = 360.0 / number_of_points
- for i in range(number_of_points):
- angle = i * angleBetweenPoints
- pointx = x + radius * math.sin(angle*math.pi/180)
- pointy = y + radius * math.cos(angle*math.pi/180)
- points.append([pointx+10, pointy+10])
- for i in range(len(points)):
- x1,y1 = points[i]
- x2,y2 = points[i*multiplier % len(points)]
- canvas.create_line(x1,y1,x2,y2)
- canvas.update()
- x = 280
- y = 280
- radius = 275
- points = []
- wait = 0
- while 1:
- number_of_points = random.randint(10,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