title: "_tkinter.TclError: image "pyimage4" doesn't exist"
body: <p>Here is part of my code called within a function:</p>
  
  <pre><code>#Labels and Window layout
  lsfpy = Tk()
  lsfpy.title("Helicopters Sydney")
  lsfpy.resizable(False, False)
  Label(lsfpy, text="Locations in Sydney").grid(row=0)
  Label(lsfpy, text="To").grid(column = 1, row=1, sticky=N)
  Label(lsfpy, text="From").grid(column = 1, row=2, sticky = W)
  Label(lsfpy, text="").grid(column = 1, row=3)
  Label(lsfpy, text="Date").grid(column = 1, row=4, sticky=SW)
  Label(lsfpy, text="Time").grid(column = 1, row=5, sticky=SW)
  
  #Map
  photo = PhotoImage(file = 'GUI Files/Map/Sydmap.gif')
  photo = photo.subsample(2)
  lbl = Label(lsfpy,image = photo)
  lbl.grid(column=0, row=3)
  </code></pre>
  
  <p>When I run it, I get this error:</p>
  
  <pre><code>    Exception in Tkinter callback
      Traceback (most recent call last):
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/__init__.py", line 1702, in __call__
      return self.func(*args)
    File "/Users/62633/Documents/2018/SDD/Webdrone Sydney/Freight.py", line 22, in calculateandnext
      saveandgotomapf(tp,am1,am2,am3,am4,am5)
    File "/Users/62633/Documents/2018/SDD/Webdrone Sydney/Freight.py", line 55, in saveandgotomapf
      locationfreight(fdpy)
    File "/Users/62633/Documents/2018/SDD/Webdrone Sydney/Locationfreight.py", line 192, in locationfreight
      lbl = Label(lsfpy,image = photo)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/__init__.py", line 2763, in __init__
      Widget.__init__(self, master, 'label', cnf, kw)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/__init__.py", line 2296, in __init__
      (widgetName, self._w) + extra + self._options(cnf))
  _tkinter.TclError: image "pyimage4" doesn't exist
  </code></pre>
  
  <p>When I comment out    </p>
  
  <pre><code> photo = photo.subsample(2)
  </code></pre>
  
  <p>The error slightly changes to:</p>
  
  <pre><code>Exception in Tkinter callback
  Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/__init__.py", line 1702, in __call__
      return self.func(*args)
    File "/Users/62633/Documents/2018/SDD/Webdrone Sydney/Freight.py", line 22, in calculateandnext
      saveandgotomapf(tp,am1,am2,am3,am4,am5)
    File "/Users/62633/Documents/2018/SDD/Webdrone Sydney/Freight.py", line 55, in saveandgotomapf
      locationfreight(fdpy)
    File "/Users/62633/Documents/2018/SDD/Webdrone Sydney/Locationfreight.py", line 192, in locationfreight
      lbl = Label(lsfpy,image = photo)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/__init__.py", line 2763, in __init__
      Widget.__init__(self, master, 'label', cnf, kw)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/__init__.py", line 2296, in __init__
      (widgetName, self._w) + extra + self._options(cnf))
  _tkinter.TclError: image "pyimage3" doesn't exist
  </code></pre>
  
  <p>If I copy the code snippet into a new file, there are no problems. </p>
  
  <p>What is causing these errors? </p>