circuitpython_screensaver
Do you need a screensaver for CircuitPython? Of course you do
Demo video of dvdlogo screensaver:
screensaver_dvdlogo.mp4
Demo video of flyingtoasters screensaver:
flyingtoasters_demo.mp4
Demo video of boingball screensaver:
screensaver_boingball_demo.mp4
For more info, see this tweet thread.
Installation
- Copy the entire
screensaver
directory to your CIRCUITPY drive - See the
demo_code.py
example (or just copy it over ascode.py
) to see how to use it
Usage
To load up a screensaver and run the screensaver forever:
from screensaver import screensaver_dvdlogo
screensaver_dvdlogo()
or
from screensaver import screensaver_flyingtoasters
screensaver_flyingtoasters()
or
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:
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 optionalnum_toasters
andnum_toasts
arguments to tune how many you wantscreensaver_boingball()
takes optionalbg_fname
argument for a background image to put behind the ball