figure the interest program object--an object that conceptually represents the applicationand something we will return to later on in addition to distinguishing between widgets and windows (also called top-level widgets)the parent-child relationships help ensure that widgets are deleted in the right order and that child widgets are automatically deleted when their parent is deleted the initializer is where the user interface is created (the widgets added and laid outthe mouse and keyboard bindings made)and the other methods are used to respond to user interactions tk allows us to create custom widgets either by subclassing predefined widget such as tkinter frameor by creating an ordinary class and adding widgets to it as attributes here we have used subclassing--in the next example we will show both approaches since the interest program has just one main window it is implemented in single class we will start by looking at the class' initializerbroken into five parts since it is rather long class mainwindow(tkinter frame)def __init__(selfparent)super(__init__(parentself parent parent self grid(row= column= we begin by initializing the base classand we keep copy of the parent for later use rather than using absolute positions and sizeswidgets are laid out inside other widgets using layout managers the call to grid(lays out the frame using the grid layout manager every widget that is shown must be laid outeven top-level ones tk has several layout managersbut the grid is the easiest to understand and usealthough for top-level layouts where there is only one widget to lay out we could use the packer layout manager by calling pack(instead of grid(row= column= to achieve the same effect self principal tkinter doublevar(self principal set(