Rodja Trappe 2 lat temu
rodzic
commit
3ccc72d786
1 zmienionych plików z 23 dodań i 40 usunięć
  1. 23 40
      website/documentation.py

+ 23 - 40
website/documentation.py

@@ -659,48 +659,31 @@ def create_full(menu: ui.element) -> None:
     ui.markdown('''
         **Packaging Tips:**
 
-        - When building a pyinstaller app, your main script can use a native
-          window (rather than a browser window) by using `ui.run(reload=False,
-          native=True)`. The `native` parameter can be `True` or `False`
-          depending on whether you want a native window or to launch a page in
-          the user's browser - either will work in the pyinstaller generated
-          app.
-
-        - Specifying `--windowed` to pyinstaller will prevent a terminal console
-          from appearing. However you should only use this option if you have
-          also specified `native=True` in your `ui.run` command. Without a
-          terminal console the user won't be able to exit the app with `^C`.
-          However with the `native=True` option, the app will automatically close when
-          the window is closed, as expected.
-
-        - Specifying `--windowed` to pyinstaller will create an `.app` file on
-          Mac which may be more convenient to distribute. When you double click
-          the app to run it, it will not show any console output. You can also
-          run the app from the command line with
-          `./myapp.app/Contents/MacOS/myapp` to see the console output.
-
-        - Specifying `--onefile` to pyinstaller will create a single executable
-          file which, whilst convenient for distribution, will be slower to
-          start up. This is not NiceGUI's fault but just the way Pyinstaller
-          zips things into a single file, then unzips everything into a
-          temporary directory before running. You can mitigate this by removing
-          `--onefile` from the pyinstaller command, and zip up the generated
-          `dist` directory yourself, distribute it, and your end users can unzip
-          once and be good to go, without the constant expansion of files due to
-          the --onefile' flag.
-
+        - When building a pyinstaller app, your main script can use a native window 
+          (rather than a browser window) by using `ui.run(reload=False, native=True)`. 
+          The `native` parameter can be `True` or `False` depending on whether 
+          you want a native window or to launch a page in the user's browser - 
+          either will work in the pyinstaller generated app.
+        - Specifying `--windowed` to pyinstaller will prevent a terminal console from appearing.
+          However you should only use this option if you have also specified `native=True` in your `ui.run` command.
+          Without a terminal console the user won't be able to exit the app with `^C`.
+          However with the `native=True` option, the app will automatically close when the window is closed, as expected.
+        - Specifying `--windowed` to pyinstaller will create an `.app` file on Mac which may be more convenient to distribute.
+          When you double click the app to run it, it will not show any console output.
+          You can also run the app from the command line with `./myapp.app/Contents/MacOS/myapp` to see the console output.
+        - Specifying `--onefile` to pyinstaller will create a single executable file which, whilst convenient for distribution, will be slower to start up. 
+          This is not NiceGUI's fault but just the way Pyinstaller zips things into a single file, then unzips everything into a temporary directory before running.
+          You can mitigate this by removing `--onefile` from the pyinstaller command, 
+          and zip up the generated `dist` directory yourself, distribute it, 
+          and your end users can unzip once and be good to go, without the constant expansion of files due to the --onefile' flag.          
         - Summary of user experience for different options:
-
             | PyInstaller | app.run() | Explanation |
-            | :--- | :---: | :---: |
-            | --onefile | `native=False` | Single executable generated in `dist/`, runs in browser |
-            | --onefile | `native=True` | Single executable generated in `dist/`, runs in popup window |
-            | Both --onefile --windowed | `native=True` | Single executable generated in `dist/` (on Mac a proper `dist/myapp.app` generated incl. icon), runs in popup window, no console appears |
-            | Both --onefile --windowed | `native=False` | Avoid (no way to exit the app) |
+            | :--- | :--- | :--- |
+            | onefile | `native=False` | Single executable generated in `dist/`, runs in browser |
+            | onefile | `native=True` | Single executable generated in `dist/`, runs in popup window |
+            | onefile and windowed | `native=True` | Single executable generated in `dist/` (on Mac a proper `dist/myapp.app` generated incl. icon), runs in popup window, no console appears |
+            | onefile and windowed | `native=False` | Avoid (no way to exit the app) |
             | Specify neither |  | A `dist/myapp` directory created which can be zipped manually and distributed. Run with `dist/myapp/myapp` |
-    ''')
-
-    ui.markdown('''
         - If you are using a Python virtual environment, ensure you `pip install
           pyinstaller` within your virtual environment so that the correct
           pyinstaller is used, or you may get broken apps due to the wrong
@@ -709,7 +692,7 @@ def create_full(menu: ui.element) -> None:
           `pyinstaller`.
     ''')
 
-    with bash_window(classes='max-w-lg w-full h-42'):
+    with bash_window(classes='max-w-lg w-full h-42 self-center'):
         ui.markdown('''
             ```bash
             python -m venv venv