I am currently programming an app GUI and will have multiple classes inheriting the root for the window as the master for thh buttons, textboxes etc. But my problem is that I’m not sure how to implement class inheritance even after reading up on how to use it with examples to my app GUI. The reason why I want to use this is because I will need the same root for another child class “class Calculator” which will also be used in the GUI class.

Parent class

class Window:
    def __init__(self):
        # initialise window
        color_themes = ["blue", "green", "dark-blue"]

        # window root
        self.root = customtkinter.CTk()

        # window size ("width x height")

        # window title
        self.root.title("My App")

Child class

class GUI(Window):
    def __init__(self):

        # create frame for login page
        self.login_frame = customtkinter.CTkFrame(master=self.root)
        self.login_frame.pack(padx=60, pady=20, fill="both", expand=True)

So i tried using super().__init__() at first. which gave me this error:

Traceback (most recent call last):
File "C:UsersUserPycharmProjectsGUIAppGUI.py", line 182, in <module>
File "C:UsersUserPycharmProjectsGUIAppGUI.py", line 35, in __init__
self.login_frame = customtkinter.CTkFrame(master=self.root)
>                                                      ^^^^^^^^^
AttributeError: 'GUI' object has no attribute 'root'

then i tried adding this into the __init__() of class Window:
self.root = root

to change the __init__() method in class GUI(Window) to

   def __init__(self, root):

this still gave the same error as before even though hovering over the self.root in
self.login_frame = customtkinter.CTkFrame(master=self.root)
gave this text “Instance attribute root of AppGUI.Window root: CTk = customtkinter.CTk()”

lastly i tried to change the super call line to
super(Window, self).__init__(root)
as i had read from the answers in the post about using __init__() to inherit instance attributes.
but this still resulted in the same error as above