title: Python GUI to scroll through photos in a window
body: <p>I am trying to develop a Python Tkinter widget that opens a window displaying a photo and allows the user to scroll through the photos using a scroll bar. For context, the idea is to be able to scroll through a timer-series of photographs.  </p>
  
  <p>So far I've been able to make a Tkinter canvas displaying an image, and a Tkinter "Scale" slider, but I am having trouble combining them to meet my goal. The result of the below code is an empty canvas window and a separate slider. The slider works and prints its position when moved, but no photo ever loads. I was hoping that when the bar was moved to position 3, photo 3 would load.  </p>
  
  <p>Any idea what I'm missing?  </p>
  
  <pre><code>import Tkinter as tk
  from PIL import ImageTk, Image
  from Tkinter import *
  
  class ImageCanvas(Frame):
      def __init__(self, master):
          Frame.__init__(self, master)
          self.grid_rowconfigure(0, weight=1)
          self.grid_columnconfigure(0, weight=1)
          self.canvas = Canvas(self, width=720, height=480, bd=0)
          self.canvas.grid(row=0, column=0, sticky='nsew', padx=4, pady=4)
  
          self.root = tk.Tk()
          self._job = NONE
          self.slider = tk.Scale(self.root, from_=0, to=3, orient = "horizontal", command=self.updateValue)
          self.slider.pack()
          self.root.mainloop()
  
      def updateValue(self, event):
          if self._job:
              self.root.after_cancel(self._job)
          self._job = self.root.after(500, self.result)
  
      def result(self):
          self._job=None
          print self.slider.get()
          returnedValue = self.slider.get()
  
  class ImgTk(tk.Tk):
      def __init__(self):
          tk.Tk.__init__(self)
          self.main = ImageCanvas(self)
          self.main.grid(row=0, column=0, sticky='nsew')
          self.c = self.main.canvas
  
          self.currentImage = {}
          self.load_imgfile(images[ImageCanvas.returnedValue()])
  
      def load_imgfile(self, filename):
          self.img = Image.open(filename)
          self.currentImage['data'] = self.img
  
          self.photo = ImageTk.PhotoImage(self.img)
          self.c.xview_moveto(0)
          self.c.yview_moveto(0)
          self.c.create_image(0, 0, image=self.photo, anchor='nw', tags='img')
          self.c.config(scrollregion=self.c.bbox('all'))
          self.currentImage['photo'] = self.photo
  
  images = ['/Users/Evan/Documents/Temp/4744.png', '/Users/Evan/Documents/Temp/4750.png', '/Users/Evan/Documents/Temp/4757.png']
  
  app = ImgTk()
  </code></pre>