you study them in the examples distribution package two notes before we beginfirstbe sure to read the code listings in this for details we won' present in the narrative secondalthough small examples that apply in this techniques will show up along the waymore realistic application will have to await more realistic programs we'll put these techniques to use in the larger examples in the next and throughout the rest of the book in factwe'll be reusing the modules we develop here oftenas tools in other programs in this bookreusable software wants to be reused firstthoughlet' do what our species does best and build some tools guimixincommon tool mixin classes if you read the last three you probably noticed that the code used to construct nontrivial guis can become long if we make each widget by hand not only do we have to link up all the widgets manuallybut we also need to remember and then set dozens of options if we stick to this strategygui programming often becomes an exercise in typingor at least in cut-and-paste text editor operations widget builder functions instead of performing each step by handa better idea is to wrap or automate as much of the gui construction process as possible one approach is to code functions that provide typical widget configurationsand automate the construction process for cases to which they apply for instancewe could define button function to handle configuration and packing details and support most of the buttons we draw example - provides handful of such widget builder calls example - pp \gui\tools\widgets py ""##############################################################################wrap up widget construction in functions for easier usebased upon some assumptions ( expansion)use **extras fkw args for widthfont/coloretc and repack result manually later to override defaults if needed##############################################################################""from tkinter import def frame(rootside=top**extras)widget frame(rootwidget pack(side=sideexpand=yesfill=bothif extraswidget config(**extrasreturn widget gui coding techniques