from Tkinter import *
from PIL import Image, ImageTk

root = Tk()

cvas = Canvas(root,width=1024,height=768)
cvas.pack()

cvas.create_line(0,0,1024,768) 		# this works fine. Tkinter works.

pilimg = Image.open('ex.jpg')
pilimg.show()			# this works fine. PIL works.

tkimg = ImageTk.PhotoImage(pilimg) 	# this fails with error message:
					# alloc: invalid block: 0x708338: b0 0 0
					# Abort trap

cvas.create_image(0,0,image=tkimg,anchor=NW) # this doesn't work because the previous line failed.

root.mainloop()
