From 803e2f5d758890fb671a5564b87b8a77776b8aa9 Mon Sep 17 00:00:00 2001 From: TheJoeCoder <joe@radialbog9.uk> Date: Thu, 12 Sep 2024 23:39:19 +0100 Subject: [PATCH] Add readme and fullscreen option --- README.md | 27 +++++++++++++++++++++++++++ config.py | 2 ++ main.py | 8 +++++++- 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..796d5ed --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# cs-fancy-clock + +A simple clock that displays the current time in a fancy way. + + +## Installation (on Pi Zero W) + +Use Wayland for the display server, especially if you're using an SPI display. X11 may also be too slow. + +```bash +cd ~ +git clone https://git.rb9.xyz/TheJoeCoder/cs-fancy-clock +cd cs-fancy-clock +sudo apt-get install python3 python3-dev python3-pip python3-pygame +python3 -m venv .venv + +# Install the requirements +# Omit the -r requirements.neopixel.txt if you don't have a neopixel strip +./.venv/bin/pip install -r requirements.txt -r requirements.neopixel.txt + +# Change access permissions for Wayland (insecure but necessary) +xhost +SI:localuser:root + +# Run the clock +sudo ./.venv/bin/python3 main.py + +``` \ No newline at end of file diff --git a/config.py b/config.py index cccd39e..1f4799f 100644 --- a/config.py +++ b/config.py @@ -1,6 +1,8 @@ PROP_SCREEN_WIDTH = 240 PROP_SCREEN_HEIGHT = 280 +PROP_WINDOW_FULLSCREEN = False + # Make the window scale larger for development PROP_WINDOW_SCALE = 3 diff --git a/main.py b/main.py index f53016b..4c94a39 100644 --- a/main.py +++ b/main.py @@ -82,7 +82,13 @@ def load_pattern(pattern_name: str, leds: ILedString): def run_screen(): # Initialise Pygame and create a window pygame.init() - screen = pygame.display.set_mode((PROP_SCREEN_WIDTH * PROP_WINDOW_SCALE, PROP_SCREEN_HEIGHT * PROP_WINDOW_SCALE)) + pg_options = 0x0 + if PROP_WINDOW_FULLSCREEN: + pg_options |= pygame.FULLSCREEN + screen = pygame.display.set_mode( + (PROP_SCREEN_WIDTH * PROP_WINDOW_SCALE, PROP_SCREEN_HEIGHT * PROP_WINDOW_SCALE), + pg_options + ) pygame.display.set_caption("Clock") # Init widgets -- GitLab