title: Tkinter Image viewer
body: <p>I'm trying to create a program using Tkinter that displays a thumbnail from several different directories in on window. So far I have this:</p>
  
  <pre><code>import Tkinter as tk
  from PIL import Image, ImageTk
  import Image, os
  
  root = tk.Tk()
  root.title('Shot Viewer')
  w, h, x, y = 1000, 1000, 0, 0
  root.geometry("%dx%d+%d+%d" % (w, h, x, y))
  
  #quit
  def quit(root):
      root.quit()
      root.destroy()
  
  path = "/media/Expansion Drive/Heros Mission 3/Scenes/Scene 1-3/Shots/"
  labels = []
  for files in os.listdir(path):
      number = files.split("_")[1]
      filed = "/media/Expansion Drive/Heros Mission 3/Scenes/Scene 1-3/Shots/Shot_{} /Frames/Shot_{}_000000.png".format(number, number)
      if os.path.lexists(filed) == 'False':
          pass
      else:
          im = Image.open(imageFile)
          im.thumbnail((96, 170), Image.ANTIALIAS)
          image = ImageTk.PhotoImage(im)
          label = tk.Label(root, image=image, name=number)
          labels.append(label)
  
  print labels
  
  for label in labels:
      panel = label.grid()
  
  panel2.grid(row=2, column=1)
  button2 = tk.Button(panel2, text='Quit', command=lambda root=root:quit(root))
  button2.grid(row=1, column=1, sticky='NW')
  
  root.mainloop()
  </code></pre>
  
  <p>However this is not working, does anyone have any suggestions?</p>
  
  <p>Thanks
  Tom</p>