I am coding app for measure power during squat. Its taking data from arduino, then there is a method which calculating it on power. This calculations are in while loop. When i press start calculation button my app freeze. I am sure that i have to use Threads here. I was looking for some basic example how to do it, but without any success. This is how its looks atm:
1.Button:
btn = tk.Button(self, text="Zacznij pomiary", command=lambda: methods.clicked(self.txtEntry, self.txtEntry1, self.txtEntry2))
btn.grid(column=0, row=3)
- Method: (read data is a function that making calculation each milisecond in while loop)
def clicked(a, b, c):
if len(a.get()) == 0 or len(b.get()) == 0 or len(c.get()) == 0:
popupmsg("Wprowadź poprawne dane!")
else:
readData(float(a.get()), float(b.get()), float(c.get()))
I am looking for some examples how to implement stop button here.