self text tag_remove(sel' 'endself text tag_add(selwherepastkeyself text mark_set(insertpastkeyself text see(whereindex past key remove any sel select key for next find scroll display def onrefind(self)self onfind(self lastfinddef onchange(self)""non-modal find/change dialog pass per-dialog inputs to callbacksmay be change dialog open ""new toplevel(selfnew title('pyedit change'label(newtext='find text?'relief=ridgewidth= grid(row= column= label(newtext='change to?'relief=ridgewidth= grid(row= column= entry entry(newentry entry(newentry grid(row= column= sticky=ewentry grid(row= column= sticky=ewdef onfind()self onfind(entry get()use my entry in enclosing scope runs normal find dialog callback def onapply()self ondochange(entry get()entry get()button(newtext='find'command=onfind grid(row= column= sticky=ewbutton(newtext='apply'command=onapplygrid(row= column= sticky=ewnew columnconfigure( weight= expandable entries def ondochange(selffindtextchangeto)on apply in change dialogchange and refind if self text tag_ranges(sel)self text delete(sel_firstsel_lastself text insert(insertchangetoself text see(insertself onfind(findtextself text update(must find first deletes if empty goto next appear force refresh def ongrep(self)""new in version threaded external file searchsearch matched filenames in directory tree for stringlistbox clicks open matched file at line of occurrencesearch is threaded so the gui remains active and is not blockedand to allow multiple greps to overlap in timecould use threadtoolsbut avoid loop in no active grepgrep unicode policytext files content in the searched tree might be in any unicode encodingwe don' ask about each (as we do for opens)but allow the encoding used for the entire pyedita text editor program/object