Q:

Tkinter animation after calls - thread safety

I have a routine to animate a path through a maze that uses Tkinter's after function to plot the steps in the path sequentially. I update a counter variable which I am checking in each call and when I reach the end of the path, I reset a few variables. It all seems to work ok, but is this approach thread safe? Will each after() call be atomically and sequentially executed even if the previous after call is not completed before the next one is supposed to start? I use those variables in another part of the code to prevent a user from rendering a second path while the first one is still ongoing. Is there a better way of doing this?
def markPath(self):
    if self.canvas is None or self.path is None:
        return

    for k,i in enumerate(self.path[1:-1]):
        window.after(20*k,self.placeMarker,i,'#ff0000')

def placeMarker(self,p,value):
    x0 = p[0]*self.scale+Maze.offset+4
    y0 = p[1]*self.scale+Maze.offset+4
    x1 = x0 + 4
    y1 = y0 + 4
    self.canvas.create_rectangle(y0,x0,y1,x1,fill=value)

    if self.path is not None and (self.counter == len(self.path)-2):
        self.path = None
        self.start = None
        self.end = None
        self.counter = 0
    else:
        self.counter += 1

A:

Tkinter is single threaded. after does nothing more than to place an item on an event queue. The queue is processed in order. Because of this, it is not possible for a second job to start before the first one finishes.
There is one exception: if the first job explicitly calls update() sometime after the next job's timer expires, the first job will be paused until the next job finishes since update() won't return until there are no more events to be processed. 
This is a good example of why you should almost never call update(). 

