title: Image not shown python tkinter
body: <p>I want to input an image in my program, when I do this code</p>
  
  <pre><code>from tkinter import *
  
  root = Tk()
  
  image1 = PhotoImage(file='dog.gif')
  label1 = Label(root, image=image1)
  label1.pack()
  
  root.mainloop()
  </code></pre>
  
  <p>The image will appear, but when I do this code</p>
  
  <pre><code>from tkinter import *
  
  class Image():
      def __init__(self, master):
          self.master = master
  
          self.display_image()
  
      def display_image(self):
          self.image = PhotoImage(file='dog.gif')
          self.label1 = Label(self.master, image=self.image)
          self.label1.pack()
  
  if __name__ == '__main__':
      root = Tk()
      Image(root)
      root.mainloop()
  </code></pre>
  
  <p>The window will appear but the image was not shown</p>