Windows 10 with Python 2.7.13 (32 bit)
I have a Python tkinter program with a progress bar. The program performs a long-running operation, and then waits for a set amount of time before repeating it.
To provide feedback to the user, a progress bar is updated in derterminate mode when counting down to the next operation, and then switches to an indeterminate bar during the operation (of unknown duration).
After 15-30mins, during a countdown using the code below, Windows pops up a python.exe has stopped working dialog, offering only the option to close the program, and the program is unresponsive (presumably because Windows has halted it).
I cannot figure out why this is occurring. During this time, in the GUI the following segment of code is running:
def wait_nextop(self, delay):
end = time.time() + delay
self.progress_bar.stop()
self.progress_bar.config(mode = 'determinate', max = delay)
while time.time() < end:
remaining = (end - time.time()) + 1
self.progress_bar.config(value = (delay - remaining))
remaining_text = str(datetime.timedelta(seconds = int(remaining)))
self.progress_text.config(text = 'Next operation in ' + remaining_text)
time.sleep(0.1)
self.progress_text.config(text = 'Operation in progress')
self.progress_bar.config(mode = 'indeterminate')
self.progress_bar.start()
In this, delay is an integer delay in seconds. self.progress_bar is an instance of ttk.ProgressBar and self.progress_text is an instance of tkinter.Label. time and datetime are from the standard libraries.
Python offers no stack trace, and I do not currently have other systems available to test this on. It should be noted that this GUI function is called by another thread, but is intended to execute within the main thread.
I've seen these similar questions, but couldn't find a working resolution: