on buttons instead of text)but part of the power of tkinter is that we need to set only the options we are interested in tailoring using oop for guis all of our gui examples so far have been top-level script code with function for handling events in larger programsit is often more useful to code gui as subclass of the tkinter frame widget-- container for other widgets example - shows our single-button gui recoded in this way as class example - pp \preview\tkinter py from tkinter import from tkinter messagebox import showinfo class mygui(frame)def __init__(selfparent=none)frame __init__(selfparentbutton button(selftext='press'command=self replybutton pack(def reply(self)showinfo(title='popup'message='button pressed!'if __name__ ='__main__'window mygui(window pack(window mainloop(the button' event handler is bound method--self replyan object that remembers both self and reply when later called this example generates the same window and pop up as example - (figures - and - )but because it is now subclass of frameit automatically becomes an attachable component-- we can add all of the widgets this class createsas packageto any other guijust by attaching this frame to the gui example - shows how sneak preview