How to add an Image to a widget? Why is the image not displayed?
<p>How can I add an image to a widget in tkinter?</p>

<p>Why when I use this code it does not work:</p>

<pre><code>some_widget.config(image=PhotoImage(file="test.png"), compound=RIGHT)
</code></pre>

<p>but this does work?:</p>

<pre><code>an_image=PhotoImage(file="test.png")
some_widget.config(image=anImage, compound=RIGHT)
</code></pre>