Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_truchetish.py
- import random
- import time
- try:
- from Tkinter import *
- except:
- from tkinter import *
- root=Tk()
- root.title("Tk_truchetish")
- ww=1200
- hh=640
- root.geometry("%dx%d+0+0"%(ww,hh))
- canvas = Canvas(root, width=ww,height=hh)
- canvas.pack()
- while 1:
- wait = time.time()+2
- canvas.delete('all')
- for y in range(0,hh,20):
- for x in range (0,ww,20):
- rnd = random.randint(0,2)
- if rnd == 1:
- canvas.create_arc(x-10, y+10, x+10, y+30, start=0, style=ARC, width=2, extent=90)
- canvas.create_arc(x+10, y-10, x+30, y+10, start=180, style=ARC, width=2, extent=90)
- elif rnd == 2:
- canvas.create_arc(x+10, y+10, x+30, y+30, start=90, style=ARC, width=2, extent=90)
- canvas.create_arc(x-10, y-10, x+10, y+10, start=270, style=ARC, width=2, extent=90)
- else:
- canvas.create_line(x+10, y, x+10, y+20, width=2)
- canvas.create_line(x, y+10, x+20, y+10, width=2)
- while wait > time.time():
- canvas.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement