title: tkinter can't add photo in class that not include mainloop
body: <p>I'm not familiar with python and specially with GUI issues.
  I'm trying to add image from other class, I found a way to add other object but not images.
  This code work fine:</p>
  
  <pre><code>from Tkinter import *
  from PIL import Image, ImageTk
  
  class Application(Frame):
      def __init__(self, master=None):
          Frame.__init__(self, master)
          self.parent = master
          self.initUI()
  
      def initUI(self):
          self.outputBox = Text(self.parent, bg='black', height= 10, fg='green', relief=SUNKEN, yscrollcommand='TRUE')
          self.outputBox.pack(fill='both', expand=True)
  
  
  
  def main():
      root = Tk()
      app = Application(root)
      app.parent.geometry('800x500')
      app.parent.configure(background = 'red')
      path = "../img/Stalin.jpeg"
      img = ImageTk.PhotoImage(Image.open(path))
      panel = Label(app.parent, image = img)
      panel.pack(side = "bottom", fill = "both", expand = "yes")  
      app.mainloop()
  
  main()
  </code></pre>
  
  <p>But when I try to add image from class it's open the window but without the image:</p>
  
  <pre><code>from Tkinter import *
  from PIL import Image, ImageTk
  
  class Application(Frame):
      def __init__(self, master=None):
          Frame.__init__(self, master)
          self.parent = master
          self.initUI()
  
      def initUI(self):
          self.outputBox = Text(self.parent, bg='black', height= 10, fg='green', relief=SUNKEN, yscrollcommand='TRUE')
          self.outputBox.pack(fill='both', expand=True)
          path = "../img/Stalin.jpeg"
          img = ImageTk.PhotoImage(Image.open(path))
          panel = Label(self.parent, image = img)
          panel.pack(side = "bottom", fill = "both", expand = "yes")  
  
  def main():
      root = Tk()
      app = Application(root)
      app.parent.geometry('800x500')
      app.parent.configure(background = 'red')
      app.mainloop()
  
  main()
  </code></pre>
  
  <p>working with python 2.7 on eclipse.</p>