I am making a genetic algorithm program that can go on forever but I want the user to be able to stop and start the execution at will. My idea was to have a button that sets a bool value that is checked at the final stage of the generation creation and if False the execution stops but keeps everything as it is so it can be continued from where it was paused however I do not know how to implement it such that I can interact with my programs UI and thus emit the signal to change the boolean.
Is the only way to do this by using a thread? I am not really sure how to use them specifically but I could learn. If this is the recommended method should I use QThread or just normal python threading? Will this cause a noticeable slow down of my program?