Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_Happy_Holidays.py
- import Tkinter
- import random
- import datetime
- year = str(datetime.datetime.now().year)
- root = Tkinter.Tk()
- w = Tkinter.Canvas(root, width=400, height=300, background="#72DEE1")
- flake = [];
- moves = []
- for i in range(60):
- flake.append(w.create_text(random.randrange(-100,420),random.randrange(-20,300),text="*",fill="#ffffff",font="Times 40"))
- moves.append([0.5 + random.random()/10,1.0 + random.random()])
- w.create_text(200,140,text="HAPPY HOLIDAYS "+year,font="Arial 26 bold",fill="#B00000")
- w.create_text(200,180,text="From The Many Who Appreciate You !!!",font="Arial 15 bold",fill="#1DB50B")
- w.pack()
- while 1:
- for i in range(len(flake)):
- p = w.coords(flake[i])
- p[0]+=moves[i][0]
- p[1]+=moves[i][1]
- w.coords(flake[i],p[0],p[1])
- if(p[1]>310):
- w.coords(flake[i],random.randrange(-100,400),-20)
- root.update_idletasks() # redraw
- root.update() # process events
Add Comment
Please, Sign In to add comment