introduction to gui programming right marginand pady (top and bottom marginkeyword arguments giving integer pixel amounts as arguments if widget is allocated more space than it needsthe sticky option is used to determine what should be done with the spaceif not specified the widget will occupy the middle of its allocated space we have set all of the first column' labels to be sticky tkinter (westand all of the second column' widgets to be sticky tkinter ew (east and west)which makes them stretch to fill the entire width available to them all of the widgets are held in local variablesbut they don' get scheduled for garbage collection because the parent-child relationships ensure that they are not deleted when they go out of scope at the end of the initializersince all of them have the main window as their parent sometimes widgets are created as instance variablesfor exampleif we need to refer to them outside the initializerbut in this case we used instance variables for the variables associated with the widgets (self principalself rateand self years)so it is these we will use outside the initializer principalscale focus_set(self updateui(parent bind(""lambda *ignoreprincipalscale focus_set()parent bind(""lambda *ignoreratescale focus_set()parent bind(""lambda *ignoreyearsscale focus_set()parent bind(""self quitparent bind(""self quitat the end of the initializer we give the keyboard focus to the principalscale widget so that as soon as the program starts the user is able to set the initial amount of money we then call the self updateui(method to calculate the initial amount nextwe set up few key bindings (unfortunatelybinding has three different meanings--variable binding is where namethat isan object referenceis bound to an objecta key binding is where keyboard action such as key press or release is associated with function or method to call when the action occursand bindings for library is the glue code that makes library written in language other than python available to python programmers through python modules key bindings are essential for some disabled users who have difficulty with or are unable to use the mouseand they are great convenience for fast typists who want to avoid using the mouse because it slows them down the first three key bindings are used to move the keyboard focus to scale widget for examplethe principallabel' text is set to principal $and its underline to so the label appears as principal $:and with the first keyboard binding in place when the user types alt+ the keyboard focus will switch to the principlescale widget the same applies to the other two bindings note that we do not bind the focus_set(method directly this is because when functions or methods are called as the result of an event binding they are given the event