Tkinter Image in a label?
<p>Im trying to present an image inside a label, although when I print the label there is no image inside it. Here is my code.</p>

<pre><code>from tkinter import *
newGameWindow = Toplevel()
newGameWindow.title("New Game")
newGameWindow.config(bg = "grey")
newGameWindow.geometry('600x600')


#courtImg = PhotoImage('basketballCourtTemplate.png')
courtImg = PhotoImage(file ='basketballCourtTemplate.png')


photo = Label(newGameWindow, image= courtImg, height = 200, width =200)

photo.pack()

newGameWindow.mainloop()
</code></pre>

<p>the image is located in the same file as the code. Am I loading in the image correctly?</p>

<p>EDIT:
this code produces exactly the same output.</p>

<pre><code>from tkinter import *
newGameWindow = Toplevel()
newGameWindow.title("New Game")
newGameWindow.config(bg = "grey")
newGameWindow.geometry('600x600')


courtImg = PhotoImage('basketballCourtTemplate.gif')


photo = Label(newGameWindow, image= courtImg, height = 200, width =200)
photo.image = courtImg
photo.pack()

newGameWindow.mainloop()
</code></pre>

<p>EDIT:
All it needed was <code>courtImg = PhotoImage(file='basketballCourtTemplate.gif')</code></p>