I am creating a simple GUI with Tkinter, with three buttons so far. My setup is very simple: i have three functions, and I am attaching those three functions to the three buttons. I understand I have to start a thread for each button to avoid freezing the GUI when clicking on the button (and running the attached function). I managed getting a thread to start for each button/function, however I don't know how to kill that thread after the function is finished? I thought it would be simpler but I'm struggling with it.
Here is my PARTIAL code below (only showing the parts that matter):
import threading
def threadButtonOne():
threading.Thread(target=Send_Data).start()
def threadButtonTwo():
threading.Thread(target=Process_Data).start()
def threadButtonThree():
threading.Thread(target=Process_Data2).start()
btn = Button(window, text="Send Data",font=("Century Gothic", 15), command=threadButtonOne)
btn.place(relx=0.5, rely=0.2, anchor=CENTER)
btn = Button(window, text="Data Processing - Step 1",font=("Century Gothic", 15), command=threadButtonTwo)
btn.place(relx=0.5, rely=0.3, anchor=CENTER)
btn = Button(window, text="Data Processing - Step 2",font=("Century Gothic", 15), command=threadButtonThree)
btn.place(relx=0.5, rely=0.45, anchor=CENTER)