I have a 'Game' class, which has to create a window with image, here's the code that I've tried, but the image does not appear. The directory there exists and no errors are produced
from tkinter import *
class Game():
def __init__(self):
self.tk = Tk()
self.tk.title(' ')
self.tk.resizable(0, 0)
self.tk.wm_attributes("-topmost", 1)
self.canvas = Canvas(self.tk, width=800, height=600)
self.canvas.pack()
self.tk.update()
self.bg = \
PhotoImage('C:\\Users\\iv4um\\ninjafight\\hj\\officelight.gif')
self.bgimage = self.canvas.create_image(0, 0, image=self.bg, \
anchor='nw')
self.tk.update()
I expect the image to be at the screen, but all I get is blank screen, with no image. Image is 800 * 600 pixels and it's a .gif.