for complete versionand watch for more on its widget configuration options in but it illustrates the application of common appearance by subclassing widgets directly--every button created from its class looks the sameand will pick up any future changes in its configurations automatically widget subclasses are programmer' toolof coursebut we can also make such configurations accessible to gui' users in larger programs later in the book ( pyeditpyclockand pymailgui)we'll sometimes achieve similar effect by importing configurations from modules and applying them to widgets as they are built if such external settings are used by customized widget subclass like our themedbutton abovethey will again apply to all its instances and subclasses (for referencethe full version of the following code is in file gui -themed-user py)from user_preferences import bcolorbfontbsize get user settings class themedbutton(button)def __init__(selfparent=none**configs)button __init__(selfparent**configsself pack(self config(bg=bcolorfont=(bfontbsize)themedbutton(text='spam'command=onspamthemedbutton(text='eggs'command=oneggsnormal button widget objects all inherit user preferences class mybutton(themedbutton)subclasses inherit prefs too def __init__(selfparent=none**configs)themedbutton __init__(selfparent**configsself config(text='subclass'mybutton(command=onspamagainmore on widget configuration in the next the big picture to take away here is that customizing widget classes with subclasses allows us to tailor both their behavior and their appearance for an entire set of widgets the next example provides yet another way to arrange for specialization--as customizable and attachable widget packagesusually known as components reusable gui components with classes larger gui interfaces are often built up as subclasses of framewith callback handlers implemented as methods this structure gives us natural place to store information between eventsinstance attributes record state it also allows us to both specialize guis by overriding their methods in new subclasses and attach them to larger gui structures to reuse them as general components for instancea gui text editor implemented as frame subclass can be attached to and configured by any number of other guisif done wellwe can plug such text editor into any user interface that needs text editing tools reusable gui components with classes