I am trying create a indeterminate progress bar in python 3 in new top level window for some process and then starting the thread for that process. What I want is that the progress bar starts and the thread is also started in background and as soon as the thread completes executing, some message is shown that the task is complete.
Code :
class myThread(threading.Thread):
def __init__(self, threadID):
threading.Thread.__init__(self)
self.threadID = threadID
def run(self):
print("Starting the thread")
func()
print("Ending the thread")
def func():
some task
...
new_top = Toplevel()
new_top.title("New Top Level")
new_top.geometry("400x170")
label = Label(new_top, text='Doing some work', justify=CENTER, bg="#CBFDCB").place(x=43,y=30)
progress_bar = ttk.Progressbar(new_top, orient="horizontal", mode="indeterminate", takefocus=True, length=320)
progress_bar.place(x=40, y=80)
progress_bar.start()
thread1 = myThread(1)
thread1.start()
thread1.join()
...
Perform post thread operations
What my problem is, the top level window with label and progress bar never appears if thread1.join() is called and if i skip this part , then the operations post thread execution does not run