Python
flying birds & snowflakes
Snowflakes: needs import random
for i in range(100):
xpt=random.randrange(1,390)
ypt=random.randrange(1,390)
myCanvas.create_line(xpt,ypt,xpt+10,ypt+10)
myCanvas.create_line(xpt+5,ypt,xpt+5,ypt+10)
myCanvas.create_line(xpt+10,ypt,xpt,ypt+10)
myCanvas.create_line(xpt,ypt+5,xpt+10,ypt+5)
this creates 100 8-pointed snowflakes that fit in a 10-pixel by
10-pixel box.
the snowflakes could be smaller or larger, and you can have more or
fewer.
you could also add
myCanvas.pack()
myCanvas.update()
time.sleep(0.1)
in the loop--then all the snowflakes do not appear all at once.
also--you
can limit the snowflakes appear above a certain level. the code
above puts
snowflakes in a 400 by 400 box.
------------------------------
Flying
Bird. Needs import time
for in in range(20):
myCanvas.create_rectangle(100,100,200,150,fill="white",outline="white")
myCanvas.create_line(100,100,150,130,200,100)
myCanvas.create_oval(135,120,165,140,fill="red")
myCanvas.pack()
myCanvas.update()
time.sleep(0.5)
repeat above code, but
create_line(100,150,150,130,200,150)
this flaps the bird's wings. you can get a smoother flight by
extra code that has
the wings at mid-level: create_line(100,125,200,125). you
can also draw eyes, beak,
and feet on the bird.