I'm doing some automation in my work using Python, I basically created a fairly simple GUI with several options, whenever to user click in one of these options the app creates a new thread with the deamon flag set to true.
Happens that most of the time everything works flawlessly, except when something that was not planned happens, then I have to manually kill the application while it keeps pressing buttons and clicking everywhere, I'm already using the safe flag from the PyAutoGui from putting the mouse on the top left corner of the screen, but this isn't quite user-friendly for users that are not so familiar with technologies, I wish I could set a key in the keyboard to act a safety switch, whenever the user press this key all the threads except the main one should be killed.
I know that there is a lot of content available about that, but I'm just a simple guy that knows some stuff about coding and I didn't quite understand how this is supposed to work, could you clarify how can I stop all threads? Or point me to some good reading material?