George David King George David King - 11 months ago 95
Python Question

Import an image as a background in Tkinter

I've searched some other questions that many people did ask here about how can someone import an image as a background from Tkinter and I've got to say that I wasm't helped a lot.
Let me explain to you my problem. I have downloaded an image,converted it to gif and save it to my desktop.However can the Tkinter window opens up it does not import the image.
Here is my code:

import Tkinter as Tk
root = Tk.Tk()
background_label = Tk.Label(root, image=background_image), y=0, relwidth=1, relheight=1)
playButton = Tk.Button(root, text='Play', command=root.destroy)

Are you able to help me?

Answer Source

You should use PhotoImage in this way.