title: PIL Image for Tkinter doesn't render unless PhotoImage variable is global
body: <p>I am having trouble converting my PIL image into a Tkinter image, here is my class:</p>
  
  <pre><code>class GameText():
      def __init__(self, parent, xPos, yPos, text, tag="default"):
          global drawTex
          self.parent = parent
          self.xPos = xPos
          self.yPos = yPos
          self.text = str(text)
          self.tag = tag
  
          image = Image.new("RGBA", (400, 400), None)
  
          draw = ImageDraw.Draw(image)
          draw.text((0, 0), self.text, font=font, fill="white")
          del draw
  
          drawTex = ImageTk.PhotoImage(image)
          self.image = self.parent.create_image(self.xPos, self.yPos, image=drawTex, tag=self.tag)
  </code></pre>
  
  <p>No image is displayed at all if drawTex isn't global, and even when it is, only one image is displayed, if I were to create these two objects, only the last would appear.</p>
  
  <pre><code>self.test1 = GameText(self, 300, 300, "ab")
  self.test2 = GameText(self, 300, 300, "hi")
  </code></pre>
  
  <p>Why does drawTex have to be global and why does only the last image get displayed?</p>