import sys if len(sys argv= calculator_test py root tk(run calcs in same process calcgui(toplevel()each in new toplevel window calccontainer(toplevel()calcsubclass(toplevel()button(roottext='quit'command=root quitpack(root mainloop(if len(sys argv= calculator_testl py calcgui(mainloop(as standalone window (default rootelif len(sys argv= calculator_test py calccontainer(mainloop(as an embedded component elif len(sys argv= calculator_test py calcsubclass(mainloop(as customized superclass figure - shows the result of running this script with no command-line arguments we get instances of the original calculator classplus the container and subclass classes defined in this scriptall attached to new top-level windows figure - the calculator_test scriptattaching and extending these two windows on the right reuse the core pycalc code running in the window on the left all of these windows run in the same process ( quitting one quits them all)but they all function as independent windows note that when running three calculators in the same process like thiseach has its own distinct expression evaluation namespace because it' class instance attributenot global module-level variable because of thatvariables set in one calculator are set in that calculator onlyand they don' overwrite settings made in other windows similarlyeach calculator has its own evaluation stack manager objectsuch that calculations in one window don' appear in or impact other windows at all text and language