own threadtimer loopand queue there may be multiple threads and loops runningand there may be other unrelated threadsqueuesand timer loops in the process for instancean attached pyedit component in ' pymailgui program can run grep threads and loops of its ownwhile pymailgui runs its own email-related threads and queue checker each loop' handler is dispatched independently from the tkinter event stream processor because of the simpler structure herethe general thread tools callback queue of is not used here for more notes on grep thread implementation see the source code aheadand compare to file _unthreadedtexteditor py in the examples packagea nonthreaded version of pyedit grep unicode model if you study the grep option' codeyou'll notice that it also allows input of tree-wide unicode encodingand catches and skips any unicode decoding error exceptions generated both when processing file content and walking the tree' filenames as we learned in and files opened in text mode in python must be decodable per provided or platform default unicode encoding this is particular problematic for grepas directory trees may contain files of arbitrarily mixed encoding types in factit' common on windows to have files with content in asciiutf- and utf- form mixed in the same tree (notepad' "ansi,"utf- ,and "unicode")and even others in trees that contain content obtained from the web or email opening all these with utf- would trigger exceptions in python xand opening all these in binary mode yields encoded text that will likely fail to match search key string technicallyto compare at allwe' still have to decode the bytes read to text or encode the search key string to bytesand the two would only match if the encodings used both succeed and agree to allow for mixed encoding treesthe grep dialog opens in text mode and allows an encoding name to be input and used to decode file content for all files in the tree searched this encoding name is prefilled with the platform content default for convenienceas this will often suffice to search trees of mixed file typesusers may run multiple greps with different encoding names the names of files searched might fail to decode as wellbut this is largely ignored in the current releasethey are assumed to satisfy the platform filename conventionand end the search if they don' (see and for more on filename encoding issues in python itselfas well as the find walker reused herein additiongrep must take care to catch and recover from encoding errorssince some files with matching names that it searches might still not be decodable per the input encodingand in fact might not be text files at all for examplesearches in python ' standard library (like the example grep for described earlierrun into handful of files which do not decode properly on my windows machine and would otherwise crash pyedit binary files which happen to match the filename patterns would fare even worse complete gui programs