Well, that is great.This displays the date at the top, with the time below in large monospaced characters filling the screen width which is exactly what I was after.
There is something which makes me unhappy (fonts do not change over time)
I would rewrite
Code:
# Display loopwhile True:# Get time & datetime = datetime.now().strftime("%H:%M")date = datetime.now().strftime("%d/%m/%y")# Select font(s) and draw to displaywith canvas(device) as draw:FontTemp = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf",21)draw.text((12, -4), (date), font = FontTemp, fill="white")FontTemp = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf",42)draw.text((0, 25), (time), font=FontTemp, fill="white") sleep(1)
Code:
FontTempNormal = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf",21)FontTempBold = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf",42)# Display loopwhile True:# Get time & datetime = datetime.now().strftime("%H:%M")date = datetime.now().strftime("%d/%m/%y")# Select font(s) and draw to displaywith canvas(device) as draw:draw.text((12, -4), (date), font=FontTempNormal, fill="white")draw.text((0, 25), (time), font=FontTempBold, fill="white") sleep(1)
Statistics: Posted by dbrion1 — Tue Mar 19, 2024 5:53 pm