-1
I’m trying to add an image inside a Frame
using the Tkinter
through the code below:
class Gui():
"""
Implements a GUI for Interactive Dictionary app
"""
def __init__(self, parent):
self.parent = parent
self.parent.title('Interactive Dictionary')
self.logo_frame = Frame(self.parent, bg='yellow')
self._layout_frames()
self.set_logo_frame()
def _layout_frames(self):
self.logo_frame.pack()
def set_logo_frame(self):
img = Image.open("static/app_image.jpg")
img = ImageTk.PhotoImage(image=img)
panel = Label(self.logo_frame, image=img)
panel.grid(row=0, column=0)
if __name__ == '__main__':
window = Tk()
app = Gui(window)
window.mainloop()
My window
is blank. Figure below:
I’m not visualizing the error, I imagine it’s something very simple.
The path
image is correct. What may be wrong?