top and bottom of the window--but the concept is widely applicable you could reuse the calculator' class by attaching it to any gui that needs calculator and customize it with subclasses arbitrarily it' reusable widget adding new buttons in new components one obvious way to reuse the calculator is to add additional expression feature buttons--square rootsinversescubesand the like you can type such operations in the command-line pop upsbut buttons are bit more convenient such features could also be added to the main calculator implementation itselfbut since the set of features that will be useful may vary per user and applicationa better approach may be to add them in separate extensions for instancethe class in example - adds few extra buttons to pycalc by embedding ( attachingit in container example - pp \lang\calculator\calculator_plus_emb py ""############################################################################ container with an extra row of buttons for common operationsa more useful customizationadds buttons for more operations (sqrt /xetc by embedding/compositionnot subclassingnew buttons are added after entire calgui frame because of the packing order/options############################################################################""from tkinter import from calculator import calcguigetcalcargs from pp gui tools widgets import framebuttonlabel class calcguiplus(toplevel)def __init__(self**args)toplevel __init__(selflabel(selftop'pycalc plus container'self calc calcgui(self**argsfrm frame(selfbottomextras [('sqrt''sqrt(% )')(' ^ ''(% )** ')(' ^ ''(% )** ')(' / '' /(% )')for (labexprin extrasbutton(frmleftlab(lambda expr=exprself onextra(expr))button(frmleftpi 'self onpidef onextra(selfexpr)text self calc text eval self calc eval trytext set(eval runstring(expr text get())excepttext set('error'pycalca calculator program/object