Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_truchet.py
- import random
- import time
- try:
- from Tkinter import *
- except:
- from tkinter import *
- root=Tk()
- root.title("Tk_truchet")
- 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,1)
- if rnd:
- 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)
- else:
- 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)
- while wait > time.time():
- canvas.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement