1

I have tried for several days to get an image displaying using the following code.

import Tkinter as tk
from PIL import ImageTk, Image

#This creates the main window of an application
window = tk.Tk()
window.title("Join")
window.geometry("300x300")
window.configure(background='grey')

path = "Aaron.jpg"

img = ImageTk.PhotoImage(Image.open(path))


panel = tk.Label(window, image = img)

#The Pack geometry manager packs widgets in rows or columns.
panel.pack(side = "bottom", fill = "both", expand = "yes")

#Start the GUI
window.mainloop()

The code is originally from this link.

How do I insert a JPEG image into a python Tkinter window?

When I run the code with my own path I get the following error messages

Python quit unexpectedly warning

and then:

The kernel appears to have died. It will restart automatically.

System info

Mac OS X Version 10.7.5 Anaconda ipython-notebook version 3.2.1 Python 2.7.10-0 PIL 1.1.7 pillow 2.9.0

This is my first question on stackoverflow so please excuse any formatting errors. I will try to correct if there is an issue. I've also tried many version of code that is similar with the same result. This only happens with this specific code.

Community
  • 1
  • 1
525delta
  • 11
  • 3

0 Answers0