of tkinter actually stems from the underling tk library it wraps python' tkinter adds software layer on top of tk that allows python scripts to call out to tk to build and configure interfaces and routes control back to python scripts that handle user-generated events ( mouse clicksthat isgui calls are internally routed from python scriptto tkinterto tkgui events are routed from tkto tkinterand back to python script in we'll know these transfers by their integration termsextending and embedding technicallytkinter is today structured as combination of the python-coded tkinter module package' files and an extension module called _tkinter that is written in _tkinter interfaces with the tk library using extending tools and dispatches callbacks back to python objects using embedding toolstkinter simply adds class-based interface on top of _tkinter you should almost always import tkinter in your scriptsthoughnot _tkinterthe latter is an implementation module meant for internal use only (and was oddly named for that reasonprogramming structure luckilypython programmers don' normally need to care about all this integration and call routing going on internallythey simply make widgets and register python functions to handle widget events because of the overall structurethoughevent handlers are usually known as callback handlersbecause the gui library "calls backto python code when events occur in factwe'll find that python/tkinter programs are entirely event driventhey build displays and register handlers for eventsand then do nothing but wait for events to occur during the waitthe tk gui library runs an event loop that watches for mouse clickskeyboard pressesand so on all application program processing happens in the registered callback handlers in response to events furtherany information needed across events must be stored in long-lived references such as global variables and class instance attributes the notion of traditional linear program control flow doesn' really apply in the gui domainyou need to think in terms of smaller chunks in pythontk also becomes object oriented simply because python is object orientedthe tkinter layer exports tk' api as python classes with tkinterwe can either use simple function-call approach to create widgets and interfacesor apply object-oriented techniques such as inheritance and composition to customize and extend the base set of tkinter classes larger tkinter guis are generally constructed as trees of linked tkinter widget objects and are often implemented as python classes to provide structure and retain state information between events as we'll see in this part of the booka tkinter gui coded with classes almost by default becomes reusable software component tkinter overview