From 63c4043a6e9bc9a0f19c8047a31fca46090b1549 Mon Sep 17 00:00:00 2001 From: Alexander Willner Date: Sun, 12 Apr 2020 22:30:01 +0200 Subject: [PATCH] fixed hanging issue if window gets closed --- things3/things3_app.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/things3/things3_app.py b/things3/things3_app.py index c5bf18a..bbbc563 100755 --- a/things3/things3_app.py +++ b/things3/things3_app.py @@ -17,7 +17,7 @@ import sys from os import system -from threading import Thread +from multiprocessing import Process import webview # type: ignore import objc # type: ignore # pylint: disable=unused-import # noqa F401 import pkg_resources.py2_warn # type: ignore # pylint: disable=unused-import # noqa F401 @@ -53,15 +53,17 @@ def main(self): min_size=(1024, 600), frameless=True) - thread = Thread(target=self.open_api) + thread = Process(target=self.open_api) try: thread.start() - webview.start() + webview.start() # blocking + thread.terminate() + thread.join() except KeyboardInterrupt: print("Shutting down...") + thread.terminate() thread.join() sys.exit(0) - if __name__ == "__main__": Things3App().main()