def reply(self)showinfo(title='popup'message='ouch!'inherit init replace reply if __name__ ='__main__'customgui(pack(mainloop(when runthis script creates the same main window and button as the original mygui class but pressing its button generates different replyas shown in figure - because the custom version of the reply method runs figure - customizing guis although these are still small guisthey illustrate some fairly large ideas as we'll see later in the bookusing oop like this for inheritance and attachment allows us to reuse packages of widgets in other programs--calculatorstext editorsand the like can be customized and added as components to other guis easily if they are classes as we'll also findsubclasses of widget class can provide common appearance or standardized behavior for all their instances--similar in spirit to what some observers might call gui styles or themes it' normal byproduct of python and oop getting input from user as final introductory scriptexample - shows how to input data from the user in an entry widget and display it in pop-up dialog the lambda it uses defers the call to the reply function so that inputs can be passed in-- common tkinter coding patternwithout the lambdareply would be called when the button is madeinstead of when it is later pressed (we could also use ent as global variable within replybut that makes it less generalthis example also demonstrates how to change the icon and title of top-level windowherethe window icon file is located in the same directory as the script (if the icon call in this script fails on your platformtry commenting-out the callicons are notoriously platform specific sneak preview