This is my 2nd question on python/tkinter... I'm experimenting on containers to maximise code reuse but I seem to be stuck at attempting to display the image for the ContainerImage section although at runtime it does set the background to black and displays the text just not the image. Would appreciate any pointers on fixing this. Thanks

import tkinter as tk
import time

class Application(tk.Tk):
    def __init__(self):
        self.withdraw()  # Hide the root while it is built.
        self.title("DoA Tools")
        self.resizable(width=False, height=False)
        win_width = 800
        win_height = 450
        scr_width = (self.winfo_screenwidth() - win_width) // 2
        scr_height = (self.winfo_screenheight() - win_height) // 2
        self.geometry("{0}x{1}+{2}+{3}".format(win_width, win_height, scr_width, scr_height))'wm', 'iconphoto', self._w, tk.PhotoImage(file="icon.png"))
        # Temporary Placeholders
        ContainerMain(self, "Title Text", "Content Text")

class ContainerMain(tk.Frame):
    def __init__(self, parent, header="", subheader=""):
        tk.Frame.__init__(self, parent), y=0, height=400, width=600)
        # Temporary Placeholders
        hdr_title = tk.Label(self, text=header), y=15, height=21, width=575)
        hdr_title.configure(bg="white", width=600, anchor="w", font="TkDefaultFont 9 bold")
        hdr_subtitle = tk.Label(self, text=subheader), y=44, height=21, width=575)
        hdr_subtitle.configure(bg="white", width=600, anchor="nw")

class ContainerButton(tk.Frame):
    def __init__(self, parent):
        tk.Frame.__init__(self, parent), y=400, height=54, width=804)
        self.configure(borderwidth="2", relief="groove", width=804)
        # Temporary Placeholders
        btn_close = tk.Button(self, text="Exit"), y=10, height=30, width=80)

class ContainerImage(tk.Label):
    def __init__(self, parent):
        tk.Label.__init__(self, parent), y=0, height=400, width=200)
        # temporary Placeholders
        image = tk.PhotoImage(master=self, file="side.png")
        self.configure(text="Side Image", fg='white', bg='black', bd=0, image=image, compound="center")

class AccountManagement:
    def __init__(self, root):
        self.__root = root
This article has been dead for over six months. Start a new discussion instead.