the original to add new button and change message' behavior although this example is simpleit demonstrates technique that can be powerful in practiceto change gui' behaviorwe can write new class that customizes its parts rather than changing the existing gui code in place the main code need be debugged only once and can be customized with subclasses as unique needs arise the moral of this story is that tkinter guis can be coded without ever writing single new classbut using classes to structure your gui code makes it much more reusable in the long run if done wellyou can both attach already debugged components to new interfaces and specialize their behavior in new external subclasses as needed for custom requirements either waythe initial upfront investment to use classes is bound to save coding time in the end standalone container classes before we move oni want to point out that it' possible to reap most of the class-based component benefits previously mentioned by creating standalone classes not derived from tkinter frames or other widgets for instancethe class in example - generates the window shown in figure - example - pp \gui\intro\gui py from tkinter import class hellopackagedef __init__(selfparent=none)self top frame(parentself top pack(self data self make_widgets(not widget subbclass embed frame attach widgets to self top def make_widgets(self)button(self toptext='bye'command=self top quitpack(side=leftbutton(self toptext='hye'command=self messagepack(side=rightdef message(self)self data + print('hello number'self dataif __name__ ='__main__'hellopackage(top mainloop(figure - standalone class package in action graphical user interfaces