I'm trying to make a project for my GitHub page and to learn how to code. I have problem with Tkinter, when I try to add some background photo nothing change.
class GuiImainPage:
def __init__(self):
self.root = Tk()
self.lib = Library()
self.MAIN_PAGE()
def MAIN_PAGE(self):
self.root.title('Library')
Label(self.root, text="Choose Login Or Register", width="300", height="2").pack()
Label(self.root, text="").pack()
Button(self.root, text="Login", height="2", width="30", command=self.login_window).pack()
Button(self.root, text="Register", height="2", width="30", command=self.register_windows).pack()
self.CONFIGURE_GUI(self.root, None, None)
self.SET_IMAGE()
self.root.mainloop()
def SET_IMAGE(self):
my_canvas = tk.Canvas(self.root, width=width, height=height)
my_canvas.pack(fill=tk.BOTH, expand=tk.YES)
bg = tk.PhotoImage(file="bookImage.png")
my_canvas.create_image(10, 10, image=bg,anchor="nw")
GuiImainPage()
Where CONFIGURE is some regular settings for all my pages. I think that should be enough to resolve the problem (Now file have ~400 lines).
If it is possible I want to not use canvas (If it require to change all file).
I try many combinations where SET_IMAGE should be invoke.