title: Tkinter how to get button image address
body: <p>I am writing a program for a school project and have come to a point where i need to check the image that is on my button so that i can run it through an if command as followed:</p>
  
  <pre><code>root=Tk()
  
  flag = PhotoImage(file='flag.png')
  
  box = PhotoImage(file='box.png')
  
  def function(event):
      if(button.cget('image')==flag):
          button.config(image=box)
      else:
          button.config(image=flag)
  
  
  button=Button(root)
  button.config(image=box)
  button.bind('&lt;ButtonRelease&gt;', function)
  button.pack()
  root.mainloop()
  </code></pre>
  
  <p>i was expecting it to change the image between flag and box everytime i click on the button but instead it just changes the image to flag the first time i click and is unresponsive for the rest of the clicks</p>