浏览代码

call window.destroy() if shutdown is requested

Rodja Trappe 1 年之前
父节点
当前提交
35480dd9fb
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      nicegui/app.py

+ 4 - 1
nicegui/app.py

@@ -62,7 +62,10 @@ class App(FastAPI):
         """
         if globals.reload:
             raise Exception('calling shutdown() is not supported when auto-reload is enabled')
-        globals.server.should_exit = True
+        if self.native.main_window:
+            self.native.main_window.destroy()
+        else:
+            globals.server.should_exit = True
 
     def add_static_files(self, url_path: str, local_directory: Union[str, Path]) -> None:
         """Add a directory of static files.