# simple example to show putting multiple
# turtles in a list and then applying the
# same function to each one, in this case
# "racing" them down the screen which also
# shows the amount of "ripple" you can
# expect given that the current drawing
# implementation doesn't use and offscreen
# buffer for drawing

from tWrapper import tWrapper

# wrapper for any additional drawing routines
# that need to know about each other
class turtleWrapper(tWrapper):
    pass

def drawMain(dc_local, w, turtleWrapper=turtleWrapper):
    t = turtleWrapper(dc_local)
    t.cls()

    #print "On your mark, get set,",
    maxTurtles = 200 # don't make this larger than 255
    tList = []
    for i in range(maxTurtles):
        t = turtleWrapper(dc_local)
        t.moveTo((i + 1) * 3, 10)
        t.rt(90)
        t.color(i + (255 - maxTurtles), 0 , 0)  # r, g, b color
        tList.append(t)

    autoRefreshTemp = tList[0].canvas.autoRefresh
    tList[0].canvas.autoRefresh = 0

    #print "go!"
    for i in range(500):
        for t in tList:
            t.fd(1)
        tList[0].canvas.refresh()

    tList[0].canvas.autoRefresh = autoRefreshTemp
