Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_pattern_of_8.py
- import random
- import time
- try:
- from Tkinter import *
- except:
- from tkinter import *
- root=Tk()
- root.title("Tk_pattern_of_8")
- ww=640
- hh=640
- canvas = Canvas(root, width=ww,height=hh)
- canvas.pack()
- bricks = (
- (0,0,40,20),
- (0,20,40,40),
- (0,0,20,40),
- (20,0,40,40),
- (0,0,20,20),
- (0,20,20,40),
- (20,0,40,20),
- (20,20,40,40)
- )
- while 1:
- wait = time.time()+1
- canvas.delete('all')
- for x in range (0,ww,40):
- for y in range(0,hh,40):
- a,b,c,d = random.choice(bricks)
- brick = a+x,b+y,c+x,d+y
- canvas.create_rectangle(brick,fill='green',outline='green')
- canvas.update()
- while wait > time.time(): 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement