Windows 7x64 Python2.7
I'm looking to apply the Lexical closures in Python thread solution to my code. Additional readings Closures in a for loop and lexical environment
I go through a list of image, thumbnail pairs, and display the thumbnail, and upon clicking the label, it should show a new TopLevel with the full sized image in it.
What actually happens is that it is only the last image of the ImagePairs is shown. Searching around, I found that thread I posted above, but I'm uncertain about how exactly to apply it to my situation.
            row, col = 0, 0
            #create a frame for the row
            rowFrame = Frame(master)
            for image, thumb in ImagePairs:
                curLbl = Label(rowFrame, image=thumb)
                curLbl.grid(row=0, column=col, sticky='news')
                curLbl.bind('<Button-1>', lambda e:self.popImage(image))  #or curLbl.image
                col += 1
                if col >= 3:
                    rowFrame.grid(row=row)
                    #create a new frame, for the next row
                    rowFrame = Frame(master)
                    col = 0
                    row += 1
I figured making a function like
def func(img=img):
   return img
and insert it in the space between grid() and bind(), but then I get the error for a missing image. How can I modify my code to fit that in?
 
     
    