ppel123 32 Newbie Poster

Hello everyone,
I have a problem with my app when closing the gui-UI, that is developed in PyQt5.
In my app I have 3 discrete threads and one of it using slot-signals for communicating with the gui.
The problem I have is that when I close the gui, and the command sys.exit(app.exec_()) is executed the gui closes but the python program still exists in the task manager (I am on Windows).
This is the code that starts the threads and terminates the gui :

if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    window = Ui()
    window.move(1600, 900)

    non_suppressed_monitor = keymonitor.KeyMonitor("non_suppressed_monitor", 1, False)

    suppressed_monitor = keymonitor.KeyMonitor("suppressed_monitor", 2, True)


    thread_delete_and_rewrite = threading.Thread(
        args=(), daemon=True)


How can I terminate all threads from the task manager as well, upon the termination of the gui?
Thanks in advance.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.