Star Trek LCARS interface for Raspberry Pi using Pygame.
The code is an example of implementing a custom MovieOS-style interface for your RaspberryPi projects that include the RaspberryPi touch screen (e.g. home automation control panel). The LCARS assets can be replaced with assets from any other style of user interface (e.g. from games, cartoons, or TV series).
(Click screenshot for a video)
True
, allows you to long-press any widget (except background items) and then drag them to any location. When you release the widget, it's new top and left co-ordinates are printed in the console, which you can use in your code to place the widget there.True
, will show the mouse cursor and a close button, for example. The mouse cursor is useful during development (on a non-touch screen).False
, will disable all sounds and prevent errors if a sound device isn't presentScreenAuthorize
. The Screens are defined in the screens
folder.LcarsScreen
class and define a setup()
method, and optionally the handleEvents()
and update()
methods.setup()
method initializes the widgets to display. See lcars_widgets.py for some of the implemented widgets. handleEvents()
method is used to respond to clicks. If this method returns True
, the event is "consumed", otherwise other widgets get a chance to act on the event. update()
method is called once per frame, allowing the Screen to update how it is drawn. Code in here needs to be highly optimized. This method is called after the widgets are drawn, but there is a pre_update()
method you can override to draw before the widgets get drawn.loadScreen()
can be called to open a new Screen. There is no backstack, so you will have to manage the Screen flows manually.SOUND
config, you need to use ui.utils.sound.Sound
instead of the normal pygame.mixer.Sound
.setup.sh
script to install the needed dependencies, OR if you have pip, run pip install -r requirements.txt
python lcars.py
from inside the app
folder.run.sh
script in the project root. Note that you will need to have xinit
installed (sudo apt-get install xinit
). While you can run it without X, the touch points will be mis-aligned, and so is not feasible./etc/rc.local
file:cd /home/pi/rpi_lcars/app
sudo -u pi xinit /usr/bin/python3 lcars.py
The above assumes you want to run the interface from the /home/pi/rpi_lcars
folder as the pi
user. To run as root, simply omit the sudo -u pi
bit.
boot/config.txt
to get the screen running at the correct resolution, and install a user-space touch driver, like this one