I currently have a very extensive python project (>8000 lines) that uses Threads to execute several operations. It also uses tkinter to make a GUI application, and before you point that out, I'm very aware that tkinter and threading don't mix very well, but I hope that's not what is causing my trouble here.
from threading import Thread
The root of my problem is that even after closing my Tkinter Application, it still runs on task manager, never completely closing. I believe this is caused by Threads still active and waiting to update widgets within the code, even after the main root is destroyed.
Since the project is so large, before I go make a python list containing all the thread objects to then call .close on each of them upon the closure of the main root, is there any command within the threading library that can in one line close all of the current active Threads?
Also, since I code as a hobby and I'm still very new to python, am I doing something very wrong or using incorrect nomenclature to communicate? lol
Thank you very much!
Also my version of everything (python+libraries) is the latest.
--What I'm about to do and what I expect--
I'm about to create a global list and then put all thread objects within it to then call .close on each of them.
I will probably change the "WM_DELETE_WINDOW" protocol to run a function that does "for obj in thread_names_list, obj.close()", before destroying the root.
I expect this to solve the task manager problem. Hopefully...
======Update======
An example of how I call threads
from threading import Thread
import tkinter as tk
import time
def main():
global root, button_foo
root = tk.Tk()
root.state('zoomed')
button_foo = tk.Button(root, text='Hello')
button_foo.place(x= 200, y= 200)
Thread(target=updates_button).start()
root.mainloop()
def updates_button():
time.sleep(10)
button_foo.config(text='Time is passing...')
if __name__ == '__main__':
main()