You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dev/dev-docs/creating-a-splash-screen.md
+11-4Lines changed: 11 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -5,19 +5,19 @@ When Foliage runs on Windows, it shows a splash screen when it first starts up.
5
5
6
6
## Splash screens in PyInstaller
7
7
8
-
On Windows, it is possible to make a PyInstaller-produced application [show a splash screen](https://pyinstaller.readthedocs.io/en/stable/usage.html#splash-screen-experimental) while an application is starting. This splash screen is shown by the loader that PyInstaller creates, and it's shown before your application's code is unpacked and loaded at run-time, so the screen shows up almost immediately after a user starts the application. This is a good thing, because PyInstaller-built binaries tend to take a long time to start.
8
+
On Windows, it is possible to make a PyInstaller-produced application [show a splash screen](https://pyinstaller.readthedocs.io/en/stable/usage.html#splash-screen-experimental) while an application is starting. This splash screen is shown by the loader that PyInstaller creates, and it's shown before your application's code is unpacked and loaded at run-time, so the screen shows up almost immediately after a user starts your application. This is a good thing, because PyInstaller-built binaries tend to take a long time to start.
9
9
10
-
The application does not need to do anything to start the splash screen (this is done by putting appropriate configuration values into the [PyInstaller specification file](../../pyinstaller-win32.spec)), but the application _does_ need to do something to make the splash screen disappear. This is accomplished by running the following bit of PyInstaller code at an appropriate time:
10
+
Your application code does not need to do anything to start the splash screen; the use of the splash screen is achieved by putting appropriate configuration values into the [PyInstaller specification file](../../pyinstaller-win32.spec)). However, your application _does_ need to do something to make the splash screen _disappear_. This is accomplished by running the following bit of PyInstaller code at an appropriate time:
11
11
12
12
```python
13
13
import pyi_splash
14
14
15
-
# The splash screen remains open until this function is called
15
+
# The splash screen remains visible until this next function is called
16
16
# or the Python program is terminated.
17
17
pyi_splash.close()
18
18
```
19
19
20
-
In Foliage, this code is wrapped up in another function defined in `ui.py`, and _that_ function is invoked by the main Foliage loop after the application creates the main Foliage window.
20
+
In Foliage, the code above code is wrapped up in another function defined in `ui.py`, and _that_ function is invoked by the main Foliage loop (in `__main__.py`) after the application creates the main Foliage window.
21
21
22
22
23
23
## Generating a splash screen a build time
@@ -37,3 +37,10 @@ I automated this process using code in the subdirectory [`dev/splash-screen`](..
37
37
3. The PyInstaller [specification file](../../pyinstaller-win32.spec) points to the `.png` file in the splash screen configuration, so that PyInstaller reads an image with an up-to-date version number.
38
38
39
39
The splash screen image for a given Foliage release is static. The small program is run at application build time, not at run-time. The image is embedded in the self-contained Foliage application created by PyInstaller.
40
+
41
+
42
+
## Setting up Windows to make this all work
43
+
44
+
To make the above process work, I had to intall two things in my Windows environment:
* The [Google Noto Sans](https://fonts.google.com/noto/specimen/Noto+Sans) font. To install a font in Windows 10: download the font file, unzip it, locate the file, right-click on it, and select _Install_ from the menu. (I think I installed the TrueType version but can't remember anymore.)
0 commit comments