Why are the two methods executed one after the other and not simultaneously? Tkinter

Viewed 25

I am facing a problem which I have only with one button but not with the others.

I have a start button which should call two methods. Once a measurement should be performed on the measuring device and then a progress bar should be running at the same time. The problem is that the progressbar runs first and as soon as it is finished, the measurement is executed.

self.start_button = ttk.Button(self.buttonframe, text="Start Test", command=lambda: self.start_measurement(self.portVar.get()) or self.start_progress_bar())

def progress(self):
    while self.pb["value"] < 100:
        self.pb['value'] += 10000/1000
        time.sleep(1)
        self.update_idletasks()
    if self.pb["value"] == 100:
        messagebox.showinfo(message='The Test is completed!')
        self.pb["value"] = 0
        self.pb.stop()
        self.update_idletasks()

def start_progress_bar(self):
    self.progress_worker = threading.Thread(target=self.progress())
    self.progress_worker.start()

def start_measurement(self, port):
    #this method is also in a thread
    self.controller.start_test(port)
    self.check_running()
0 Answers
Related