http://stackoverflow.com/questions/7310511/how-to-create-downloading-progress-bar-in-ttk
I reformatted the commenter's very helpful example to make the window quit when 100% is reached. I had to feel my way around how to add the quit and the destroy; I tried making a root object from the launch of Tk() and using it's quit and destroy, but for some reason that didn't work like it did in my other display classes. So in the end, here is my slightly modified version of the original program:
import Tkinter as tk
import ttk
class SampleApp(tk.Tk):
def __init__(self, *args, **kwargs):app = SampleApp()
tk.Tk.__init__(self, *args, **kwargs)def start(self):
##root = self.root = tk.Tk()
##root.title('root title')
self.button = ttk.Button(text="start", command=self.start)
self.button.pack()
self.progress = ttk.Progressbar(self, orient="horizontal",
length=200, mode="determinate")
self.progress.pack()
self.bytes = 0
self.maxbytes = 0
self.progress["value"] = 0def read_bytes(self):
self.maxbytes = 50000
self.progress["maximum"] = 50000
self.read_bytes()
'''simulate reading 500 bytes; update progress bar'''
self.bytes += 500
self.progress["value"] = self.bytes
if self.bytes < self.maxbytes:else:
# read more bytes after 100 ms
self.after(100, self.read_bytes)
self.quit()
app.mainloop()
app.destroy()