[Tutor] UsualAttForgottenError - Was: new to this

Gregor Lingl glingl@aon.at
Sun, 11 Aug 2002 20:10:59 +0200


This is a multi-part message in MIME format.
--------------070503030009080704020900
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

As the code in the email is not correctly indented (at least in my 
email-client)
here the forgotten attachment
Sorry, Gregor


--------------070503030009080704020900
Content-Type: text/plain;
 name="simplesirp.py"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="simplesirp.py"

#### Sirpinski - triangle
#### glingl@aon.at

from Tkinter import *
from random import randrange

root = Tk()
img  = PhotoImage(width=300, height=300)
lbl  = Label(root, image=img, bg='white')
lbl.pack()

corners = [a, b, c] = [(22,260),(278,260),(150, 38)]
p = (randrange(300), randrange(300))
for pixel in corners+[p]: img.put('black',pixel)
root.update()

done = 0

def start(event):
    p = pixel  # weird!
    while not done:
        for i in range(20):
            c = corners[randrange(3)]
            p = ((p[0]+c[0])/2.0,(p[1]+c[1])/2.0)
            dot = (int(p[0]), int(p[1]))
            img.put('black',dot)
        root.update()

def exit(event):
    import sys
    global done
    done = 1
    sys.exit()
            
root.bind('<Button-1>', start)
root.bind('<Escape>', exit)

root.mainloop()

--------------070503030009080704020900--