include weekday in /start/clock

This commit is contained in:
Christoph Haas 2026-01-16 22:44:19 +01:00
parent 39cd98823a
commit a82745d6a0

View file

@ -14,16 +14,17 @@ def start(stop_event, text="Hello World!"):
draw = ImageDraw.Draw(image_buffer) draw = ImageDraw.Draw(image_buffer)
while not stop_event.is_set(): while not stop_event.is_set():
# All to black # All to black
draw.rectangle( ((0,0),(lib.display.matrix.width-1,lib.display.matrix.height-1)), fill=(0,50,0) ) draw.rectangle( ((0,0),(lib.display.matrix.width-1,lib.display.matrix.height-1)), fill=(0,0,0) )
#draw.rectangle( ((0,0),(lib.display.matrix.width-1,lib.display.matrix.height-1)), fill=(255,255,255) )
# Current time # Current time
now = datetime.datetime.now() now = datetime.datetime.now()
#now_string = now.strftime('%d. %B %Y %H:%M:%S') #now_string = now.strftime('%d. %B %Y %H:%M:%S')
# Date into top left # Date into top left
draw.text((0, 0), now.strftime('%d. %B %Y'), fill=(255, 255, 0), font=lib.display.matrix.font) draw.text((10, 0), now.strftime('%d. %B %Y'), fill=(255, 255, 0), font=lib.display.matrix.font)
# Time into middle # Time into middle
draw.text((20, 20), now.strftime('%H:%M:%S'), fill=(0, 255, 255), font=lib.display.matrix.large_font) draw.text((100, 20), now.strftime('%H:%M:%S'), fill=(0, 255, 255), font=lib.display.matrix.large_font)
# Weekday
draw.text((10, 33), now.strftime('%A'), fill=(255, 0, 255), font=lib.display.matrix.font)
float_seconds = now.second + now.microsecond/10**6 float_seconds = now.second + now.microsecond/10**6
length = 64*4/60.0*float_seconds length = 64*4/60.0*float_seconds