Python quits in PhotoImage
Question: The following code makes Python "quit unexpectedly" when trying to create the
PhotoImage instance (it prints 1 and quits). I'm on OS X 10.9.5, using Python
2.7.10, ActiveTcl 8.6.4 from ActiveState, running the script from IDLE using
Run / Run Module. Any clue? I'm totally new to Python and all the GUI modules

    
    
    import numpy as np
    import collections
    import math
    import Tkinter 
    from PIL import Image, ImageTk
    
    # A root window for displaying objects
    root = Tkinter.Tk()  
    
    # Convert the Image object into a TkPhoto object
    im = Image.open('samples.png')
    print 1
    imgtk = ImageTk.PhotoImage(image=im) 
    print 2
    # Put it in the display window
    Tkinter.Label(root, image=imgtk).pack() 
    root.mainloop()
    


Answer: did you try something link this:

    
    
    import Tkinter 
    from PIL import Image, ImageTk
    
    root = Tkinter.Tk()  
    imgtk = ImageTk.PhotoImage(file='test.jpg') 
    Tkinter.Label(root, image=imgtk).pack() 
    root.mainloop()
    

