Tkinter image does not show
Question: I've been trying to set up a GUI using python and the Tkinter package. I am
having a problem where the image does not show. Here is my code.

    
    
    import Tkinter as tk
    from PIL import Image, ImageTk
    
    
    class Application(tk.Frame):
        def __init__(self, master=None):
            tk.Frame.__init__(self, master)
            self.grid()
            self.createWidgets()
    
        def createWidgets(self):
            self.image = Image.open("my_image.png")
    
            self.photo = ImageTk.PhotoImage(self.image)
    
            self.label = tk.Label(self, image=self.photo)
            self.label.image = self.photo # keep a reference!
            self.label.grid(row=0,column=1)
    
    
    
    app = Application()
    app.master.title("Sample application")
    app.mainloop()   
    

I've included the keep refernce line suggested by others however it does not
seem to be working. I'm using OS X 10.10.4 and Python 2.7.12 :: Anaconda
custom (x86_64)

Thanks!


Answer: I tested this on Miniconda 2 on Linux and your sample worked just fine.

What do you mean by Python 2.7.12 :: Anaconda custom? Is it a self-built
Python?

