title: Tkinter PhotoImage in function doesn't appear
body: <p>I'm creating a little program to show if something is ok, but I have a problem with the images. It was working until I create a function to generate my page
  <a href="https://i.stack.imgur.com/Zfi4n.png" rel="nofollow noreferrer">Without images</a></p>
  <pre><code>def genTout(matInput):
      #images
      vert_off = PhotoImage(file=r&quot;.\asset\vert_off.png&quot;)
      rouge_off = PhotoImage(file=r&quot;.\asset\rouge_off.png&quot;)
      vert_on = PhotoImage(file=r&quot;.\asset\vert_on.png&quot;)
      rouge_on = PhotoImage(file=r&quot;.\asset\rouge_on.png&quot;)
  
      #frame
      rightFrame = Frame(highlightbackground=&quot;black&quot;,highlightthickness=5 ,bg=&quot;grey&quot;)
      buttonControl = Frame(rightFrame,highlightbackground=&quot;black&quot;,highlightthickness=5 ,bg=&quot;grey&quot;)
  
      
      for i in range(0,4):
          Label(buttonControl,text=i+1).grid(row=0,column=i+2)
          Label(buttonControl,image=(vert_on if matInput[i*2] == 0 else vert_off)).grid(row=1,column=i+2)
          Label(buttonControl,image=(rouge_on if matInput[i*2+1] == 0 else rouge_off)).grid(row=2,column=i+2)
  
      return frame
  </code></pre>
  <p>When i take my code on the main it's working but if I put the code inside a function no images appear</p>
  <p>Here is my main where I get the return</p>
  <pre><code>root = Tk()
  PanelView = PanedWindow(width=100, bd=5,relief=&quot;raised&quot;,bg=&quot;grey&quot;)
  PanelView.pack(fill=BOTH,expand=1)
  #my side bar code
  ...
  
  rightFrame = genTout(matInput)
  PanelView.add(rightFrame)
  </code></pre>