the guimuch as beforec:\pp \gui\intropython gui py hello number hello number hello number hello number also as beforeself data retains state between eventsand callbacks are routed to the self message method within this class unlike beforethe hellopackage class is not itself kind of frame widget in factit' not kind of anything--it serves only as generator of namespaces for storing away real widget objects and state because of thatwidgets are attached to self top (an embedded frame)not to self moreoverall references to the object as widget must descend to the embedded frameas in the top main loop call to start the gui at the end of the script this makes for bit more coding within the classbut it avoids potential name clashes with both attributes added to self by the tkinter framework and existing tkinter widget methods for instanceif you define config method in your classit will hide the config call exported by tkinter with the standalone class package in this exampleyou get only the methods and instance attributes that your class defines in practicetkinter doesn' use very many namesso this is not generally big concern +it can happenof coursebut franklyi've never seen real tkinter name clash in widget subclasses in some years of python coding moreoverusing standalone classes is not without other downsides although they can generally be attached and subclassed as beforethey are not quite plug-and-play compatible with real widget objects for instancethe configuration calls made in example - for the frame subclass fail in example - example - pp \gui\intro\gui py from tkinter import from gui import hellopackage or get from gui --__getattr__ added frm frame(frm pack(label(frmtext='hello'pack(part hellopackage(frm+if you study the tkinter module' source code (todaymostly in file __init__ py in lib\tkinter)you'll notice that many of the attribute names it creates start with single underscore to make them unique from yoursothers do not because they are potentially useful outside of the tkinter implementation ( self masterself childrencuriouslyat this writing most of tkinter still does not use the python "pseudoprivate attributestrick of prefixing attribute names with two leading underscores to automatically add the enclosing class' name and thus localize them to the creating class if tkinter is ever rewritten to employ this featurename clashes will be much less likely in widget subclasses most of the attributes of widget classesthoughare methods intended for use in client scriptsthe single underscore names are accessible toobut are less likely to clash with most names of your own reusable gui components with classes