Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_no_ones.py
- from Tkinter import *
- from math import sqrt
- from random import shuffle as rs
- def oRGB(rgb): # pass
- r,g,b = rgb
- return "#%02x%02x%02x" % (r,g,b)
- ww = 600
- hh = 600
- root = Tk()
- root.title("# Tk_no_ones")
- root.geometry("%dx%d+0+0"%(ww,hh))
- canvas = Canvas(root, width=ww, height=hh)
- canvas.grid()
- # set up spiral
- step = 1
- state = 0
- numSteps = 1
- turnCounter = 1
- stepSize = 5
- cols = ww / stepSize
- rows = hh / stepSize
- totalSteps = cols * rows
- x = ww / 2
- y = hh / 2
- COLORS = 'red orange yellow green blue purple'.split()
- t = stepSize
- i = 12345
- iii = 1
- s = ''
- Lc = len(COLORS)
- while 1:
- canvas.delete('all')
- for y in range(0,hh,stepSize):
- for x in range(0,ww,stepSize):
- if len(s) < 100:
- s += str(i).replace('1','')
- i += 1
- iii = int(s[:3])
- s = s[3:]
- color = int(iii)%Lc
- canvas.create_rectangle((x,y,x+t,y+t), fill=COLORS[color], outline='')
- canvas.update()
Add Comment
Please, Sign In to add comment