Homworkcode – ts

from Tkinter import *
import random
#--------------------
w=640
h=480
canvas = Canvas(bg = '#00BFFF',width=w,height=h)
canvas.pack(expand=YES, fill=BOTH)
canvas.create_line(0, h*0.75, w, h*0.75, fill = '#fff')
#--------------------
stX = w/2
stY = h*0.75
walkStep = 10
for i in range(1000):
    rndWalkX =random.randint(-walkStep,walkStep)
    rndWalkY =random.randint(-walkStep,walkStep)
    enX =stX +rndWalkX
    enY =stY +rndWalkY
    canvas.create_line(stX, stY, enX, enY, fill = '#fff')
    stX=enX
    stY=enY
for i in range(10):
    canvas.create_text(random.randint(0,w),random.randint(0,h),fill = '#fff', text = "!")
mainloop()

Comments are closed.