silas-hw / NRP-2022-OCR

OCR software project created for a Nuffield Research Placement
MIT License
0 stars 0 forks source link

Run OCR and TTS in separate thread or process. #7

Closed silas-hw closed 2 years ago

silas-hw commented 2 years ago

Tkinter freezes when the OCR and TTS are running. To fix this we can do the OCR and TTS in a thread or multiprocess (which built-in libraries exist for!). The only tricky part will be disabling the buttons whilst the TTS is playing to stop the user from creating too many threads or processes.

silas-hw commented 2 years ago

TTS now uses a multiprocess process! Checking task manager when running the app shows that once the TTS finishes Python kills the 'zombie' process by itself. There's no way of 'activating' the buttons after the TTS has finished within the TTS function itself. However, a solution would be calculating how long the TTS should take by its rate and the length of the text and then using the 'after' method in Tkinter to reactivate the buttons after the TTS has finished.

silas-hw commented 2 years ago

Deactivation and reactivation of buttons are now added.