title: Tkinter not displaying image
body: <p>I have this code:</p>
  
  <pre><code>from tkinter import *
  import urllib
  import urllib.request
  from bs4 import BeautifulSoup
  import Pydeck
  import sys
  from collections import defaultdict
  
  root = Tk()
  name=""
  def buttonclicked():
      name()
      picture()
  
  def name():
  
      all_lists=[] #all lists
      text = inputfield.get()
      Pydeck.loadDatabase('DATABASE PATH')
      cardName = Pydeck.getCardsFromName(text)
      if not cardName == "":
              c = Pydeck.Card(cardName)
      tex.insert(END, c.name)
      level="\nLevel %s" % c.level + " " + c.attribute + " " + c.typestring 
      tex.insert(END, level)
      atk="\nAtk: %s" % c.attack
      tex.insert(END, atk)
      defe="\nDef: %s" % c.defense
      tex.insert(END, defe)
      typestring='\n%s' %c.typestring
      desc='\n%s' %c.description
      seperator='\n--------------------\n'
      tex.insert(END, typestring)
      tex.insert(END, desc)
      tex.insert(END,seperator)
      #--
      tex.see(END)             # Scroll if necessary
      return c.cardID
  
  
  def picture():    
      text = inputfield.get()
      gifdir = "PICTURE FOLDERS PATH"
      Pydeck.loadDatabase('DATABASE PATH')
      cardName = Pydeck.getCardsFromName(text)
      if not cardName == "":
          c=Pydeck.Card(cardName)
      filename='{}.gif' .format(c.cardID)
      img = PhotoImage(file=gifdir+filename)
      can = Canvas(root)
      can.pack(fill=BOTH,side='top')
      can.config(width=img.width(), height=img.height())        
      can.create_image(2, 2, image=img, anchor=NW)
  
  tex=Text(root)
  tex.pack(side='right')
  inputfield = Entry(root)
  inputfield.pack(side='bottom')
  but = Button(root,text="Enter Name", command = buttonclicked) #Calls name function
  but.pack(side='bottom')
  text = inputfield.get()
  
  root.mainloop()
  </code></pre>
  
  <p>Ok, so in short the the program is in Tkinter for Python 3.3. It asks the user to input a name of a monster, it then searches for the monster in the database and returns the monster's attributes this is done in the <code>name</code> function. I want it to display a picture of the monster which is where I'm running into trouble. So the <code>picture</code> function takes one of the attributes specifically the <code>cardID</code> attribute and uses that as the name of the gif file. However it doesn't display the picture and I don't know why. Does anyone know why?</p>