https://github.com/todbot/circuitpython_screensaver
Do you need a screensaver for CircuitPython? Of course you do
https://github.com/todbot/circuitpython_screensaver
Last synced: 8 months ago
JSON representation
Do you need a screensaver for CircuitPython? Of course you do
- Host: GitHub
- URL: https://github.com/todbot/circuitpython_screensaver
- Owner: todbot
- License: mit
- Created: 2021-08-18T19:16:01.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-04-05T18:11:37.000Z (about 2 years ago)
- Last Synced: 2025-05-08T02:18:26.129Z (about 1 year ago)
- Language: Python
- Size: 83 KB
- Stars: 12
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# circuitpython_screensaver
Do you need a screensaver for CircuitPython? Of course you do
Demo video of dvdlogo screensaver:
https://user-images.githubusercontent.com/274093/129969608-a1ea6c81-c9af-4391-923e-143fcaf08a24.mp4
Demo video of flyingtoasters screensaver:
https://user-images.githubusercontent.com/274093/129991271-908bda7a-8aca-4b34-a2d6-8dba57bfbeea.mp4
Demo video of boingball screensaver:
https://user-images.githubusercontent.com/274093/130105797-5048cdb5-e53a-4bdf-a39a-1e45ab7f0733.mp4
For more info, see [this tweet thread](https://twitter.com/todbot/status/1428096525217931264).
## Installation
- Copy the entire `screensaver` directory to your CIRCUITPY drive
- See the `demo_code.py` example (or just copy it over as `code.py`) to see how to use it
## Usage
To load up a screensaver and run the screensaver forever:
```py
from screensaver import screensaver_dvdlogo
screensaver_dvdlogo()
```
or
```py
from screensaver import screensaver_flyingtoasters
screensaver_flyingtoasters()
```
or
```py
from screensaver import screensaver_boingball
screensaver_boingball()
```
To make a screensaver stop after a condition is met, pass in a function as the
`should_exit_func` parameter. If this function returns `True` the screensaver
exits.
For example. this `exit_screensaver()` function returns `True` after 10 seconds:
```py
saver_time = time.monotonic()
def exit_screensaver():
return (time.monotonic() - saver_time > 10) # allow 10 secs of savering
screensaver_dvdlogo( should_exit_func=exit_screensaver )
```
## Notes
- Assumes CircuitPython 7, but only for `rainbowio`. And should work in CP6
- `screensaver_flyingtoasters()` takes optional `num_toasters` and `num_toasts` arguments to tune how many you want
- `screensaver_boingball()` takes optional `bg_fname` argument for a background image to put behind the ball