if __name__ ='__main__'if len(sys argv simpleeditor(file=sys argv[ ]mainloop(elsesimpleeditor(mainloop(select text widget filename on command line or notstart empty thistoowas written with one eye toward reuse--the simpleeditor class it defines could be attached or subclassed by other gui code as 'll explain at the end of this sectionthoughit' not yet as robust as general-purpose library tool should be stillit implements functional text editor in small amount of portable code when run standaloneit brings up the window in figure - (shown editing itself and running on windows)index positions are printed on stdout after each successful find operation--herefor two "deffindswith prior selection removal logic commentedout in the script (uncomment this line in the script to get single-selection behavior for finds) :\pp \gui\tourpython simpleedit py simpleedit py pp scrolledtext figure - simpleedit in action the save operation pops up the common save dialog that is available in tkinter and is tailored to look native on each platform figure - shows this dialog in action on windows find operations also pop up standard dialog box to input search string text