Two concurrent threads using tkinter and threading
You need to remove the parentheses from the functions you pass to threading, as what you are doing calls the functions, instead of passing the function handle. So change:
def start_opencv():
threading.Thread(target=opencv_code()).start()
def start_knob_tracking():
threading.Thread(target=knob_tracking()).start()
to:
def start_opencv():
threading.Thread(target=opencv_code).start()
def start_knob_tracking():
threading.Thread(target=knob_tracking).start()
You can verify that this is working correctly by changing the functions to:
def opencv_code():
print("recorder")
time.sleep(10)
print("recorder again")
def knob_tracking():
print("recorder1")
time.sleep(5)
print("recorder1 again")
And pressing both buttons.