When you move Tkinter windows stops program
Most likely the problem is because you are calling update
. You should never do that unless you know for certainty what the ramifications are. update
causes a new event loop to be entered. Essentially, you end up with an infinite loop inside an infinite loop.
Try changing your update
to update_idletasks
and see if that solves your problem. This variation of update
only processes "idle" events such as screen redraws and is considerably less likely to cause problems.
Also, you definitely don't need "update; insert; delete; update". That won't have any noticeable effect. A single call to update_idletasks
after the delete is sufficient.
Finally, you can avoid the use of update_idletasks
completely by rearranging your code. Write a function that reads a single chunk of data and updates the progress bar. Then, if it hasn't reached EOF, use after
to call that function again a few milliseconds later. When it reaches EOF it stops calling itself. Doing this means you don't have to create your own potentially infinite loop, and the event loop is guaranteed to be entered once per iteration. Once this EOF is detected you can then call a function (again using after
) to do any final processing.