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: README.md
+33-11Lines changed: 33 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,18 @@
1
1
# Arcade Screen Saver Framework
2
2
3
-
A very simple Python framework for making screen savers for Windows. Uses the [Arcade](https://github.com/pythonarcade/arcade) 2D video game library.
3
+
A very simple Python framework that allows you to write official Windows screen savers using
4
+
Python and the [Arcade](https://github.com/pythonarcade/arcade) 2D video game library.
4
5
5
-
Most Arcade applications that use the class-centric Arcade API (ex: derive a window from `arcade.Window`) can be made into a Windows screen saver.
6
-
Usually, it is as simple as adding the framework import to your existing application and creating your window with `window = screensaver_framework.create_saver_win(MyGameClass)`
6
+
Most Arcade applications that use the class-centric Arcade API (ex: derive a window from `arcade.Window`)
7
+
can be made into a Windows screen saver. Usually, it is as simple as adding the framework import to your
8
+
existing application and creating your window with `window = screensaver_framework.create_saver_win(MyGameClass)`
7
9
8
10
This framework provides your app:
9
11
* What it needs to interface with Windows so your Arcade application is seen as an official Windows screen saver.
10
12
* Input event handling to automatically exit the application when any keyboard or mouse input is detected.
11
-
* Handling of multi-monitor setups (draws screen saver on largest screen)
13
+
* Handling of multi-monitor setups (draws screen saver visuals on largest monitor)
12
14
* An included installation script that takes your Arcade application and:
13
-
* Bundles it into a one-file executable (via PyInstaller) necessary for Windows screen savers
15
+
* Bundles it into a one-file .exe (via PyInstaller) necessary for Windows screen savers
14
16
* Installs the bundle in the appropriate place with the appropriate name so that Windows can find it.
15
17
16
18
# Quick start
@@ -35,8 +37,15 @@ Must run this command from a Command Prompt that was opened with "Run as adminis
After installation, you need to go into Window's "Screen Saver Settings" dialog and
38
-
select your newly installed screen saver. Click the "Preview" button on the dialog
39
-
and you should see your screen saver appear after a couple seconds.
40
+
select your newly installed screen saver. This is usually accomplished by following steps similar to:
41
+
42
+
* Right click on the Windows desktop
43
+
* Select "Personalilze"
44
+
* Click "Lock screen" in left pane
45
+
* Scroll to the bottom of the dialog and click link labeled "Screen saver settings"
46
+
* In the "Screen Saver Settings" dialog, select your screen saver from the "dropdown"
47
+
* Enter a "Wait" time for how long your computer must be idle before it starts the screen saver
48
+
* Click the "Preview" button to see your screen saver
40
49
41
50
*Note: The "Screen Saver Settings" dialog will feel very sluggish while your have a custom
42
51
screen saver selected. This is because Windows is running the screen saver application
@@ -78,11 +87,11 @@ Open a Command Prompt terminal with "Run as administrator", make sure the proper
78
87
79
88
As the `arcade_screensaver_framework` handles input events, your code shouldn't have any `on_keyboard_press`, `on_mouse_press`, `on_mouse_motion` event handlers.
80
89
81
-
# Technical reference
90
+
# Reference
82
91
83
-
## What is required in a screen saver
92
+
## What is required in a screen saver?
84
93
85
-
To write an Arcade script that can be used as a screen saver, just a few things need to be done.
94
+
To write an Arcade script that can be used as a screen saver, just a few things need to be done in the code.
86
95
Refer to the `my_test.py` example above for a concrete illustration of the points below.
87
96
88
97
First, import the module at the top of your script:
@@ -116,7 +125,7 @@ try to provide input event handlers like `on_mouse_motion` or `on_keyboard_press
116
125
as these could interfere with arcade_screensaver_framework's operation.
117
126
118
127
### Resolution selection
119
-
When the screensaver is run in fullscreen mode, the framework chooses the most
128
+
When the screen saver is run in fullscreen mode, the framework chooses the most
120
129
appropriate screen resolution. This way, your application can run on computers
121
130
with screens of any size. This means your screen saver should query the size of
122
131
the screen when it starts with a function like `.get_size()` and adjust to the
@@ -130,4 +139,17 @@ height and width dynamically.
130
139
- second parameter (optional): can specify keyword arguments that will be passed to the
131
140
`Windows` constructor
132
141
142
+
### Windows screen saver interface
143
+
144
+
For an application to be an official Windows screen saver, it must do the following things:
145
+
146
+
| Requirements | How framework fulfills it |
147
+
|--------------|---------------------------|
148
+
| Must be a Windows .exe file. | The `install_screensaver.bat` script uses [PyInstaller](https://www.pyinstaller.org/) to bundle the Python script into an .exe. |
149
+
| The .exe must be renamed to have a `.scr` extension and be saved into a specific Windows system directory. | Handled by `install_screensaver.bat` script. |
150
+
| Must handle a few command line flags when run. This is how Windows controls the screen saver. | This framework parses the command line flags and responds appropriately. |
151
+
| Executable must exit when it receives keyboard or mouse input events. | Input handling is taken care of by the framework. |
152
+
153
+
Reference: Windows [Screen Saver command line arguments](https://docs.microsoft.com/en-us/troubleshoot/windows/win32/screen-saver-command-line)
0 commit comments