How to implement indeterminate Progressbar in Tkinter?
<p>My application has some time-consuming background processes to be run occasionally. I want to show that the application is working using a simple <strong>indeterminate</strong> <code>ttk.Progressbar</code>.
However, my implementation only shows static progress bar.</p>

<p>Anyway, here is how I implemented it.</p>

<pre><code>class MyApp(ttk.Frame):
    def __init__(self, master):
        ttk.Frame.__init__(self, master)
        fname = 'test.txt'
        self.build_ui()
        self.process_file(fname)

    def process_file(self, fname):
        self.show_progress(True)
        fdata = self.read_file(fname)
        fdata = self.spellcheck(fdata)
        self.show_progress(False)
        return fdata

    def show_progress(self, start)
        if start:
            self.prog_win = tk.Toplevel()
            self.prog_win.title('Working...')
            self.prog_win.resizable(0, 0)
            self.progress_bar = ttk.Progressbar(self.prog_win,
                                                orient=tk.HORIZONTAL,
                                                mode='indeterminate',
                                                takefocus=True)
            self.progress_bar.grid()
            self.progress_bar.start()
        else:
            self.progress_bar.stop()
            self.prog_win.destroy()


root = tk.Tk()
root.update()
gui = MyApp(root)
gui.mainloop()
</code></pre>

<p>The code above does not work as intended. The <code>Progressbar</code> appears static, it does not move and just hangs there forever. I tried to use threading but if I start <code>show_progress</code> in a separate <code>Thread</code> it always gets executed after the processing has been done.</p>

<p>What am I doing wrong?</p>