With it being the festive season and looking for something for my recent Inky PHAT purchase needing to be I used I decided to create a Countdown To Christmas.
I started off with a basic countdown in Python, where today’s date (2nd) is taken away from the 25th (Christmas Day).
Countdown to Christmas code
Then I used the guidance provided by the excellent PiMoroni to create a small program that did the Christmas Countdown and display it on the Inky PHAT.
Countdown to Christmas code outputting to InkyPHAT
The original output did not go exactly as planned….
How many days until Christmas?
But with a little modification the Inky PHAT correctly displays the amount of days until Christmas.
Inky PHAT displaying days until Christmas
——
#!/bin/python3
# geektechstuff
# import date from datetime
from datetime import date
# import the InkyPHAT library
from inky import InkyPHAT
# setting up InkyPHAT
inky_display = InkyPHAT(“black”)
inky_display.set_border(inky_display.WHITE)
# import Python Image Library modules
from PIL import Image, ImageFont, ImageDraw
# creates an image (img) and a then a canvas (draw) on the image
One thought on “Christmas Countdown (Python / Raspberry Pi)”
Comments are closed.