Python 2.7 How to add images on the canvas with Tkinter
Question: I need to add an image to the canvas. I have tried countless amounts of
things, and finally decided to make a question on here.

This is what I have imported

    
    
    from Tkinter import *
    import tkFont
    from PIL import ImageTk, Image
    

And this is the line of code I'm trying to add to import an image from the
same folder the main file is in.

    
    
    c.create_image(100,100, anchor=N, image = ghost.jpg)
    

I've also tried putting `""`s around `'ghost.jpg'` and it says _the Image does
not exist_ then. Without the quotes it says _"global name 'ghost' does not
exist."_

Can anyone help?


Answer: [Canvas.create_image](http://effbot.org/tkinterbook/canvas.htm#Tkinter.Canvas.create_image-
method)'s image argument

> should be a [PhotoImage](http://effbot.org/tkinterbook/photoimage.htm) or
> [BitmapImage](http://effbot.org/tkinterbook/bitmapimage.htm), or a
> compatible object (such as the [PIL's
> PhotoImage](http://effbot.org/imagingbook/imagetk.htm)). The application
> must keep a reference to the image object.

