Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4762

Python • Re: Clock/Calendar Using SH1106 128x64 Pixel I2C OLED Display

$
0
0

Code:

draw.text((-2, 17), (timeH), font=FontTime, fill="white")draw.text((49, 11), (":"), font=FontTime, fill="white")draw.text((70, 17), (timeM), font=FontTime, fill="white")
y is different, as you put ":" with a vertical offset; else, code could have been made simpler.(you could even have made a single string, with "%-H:%-M" format (leading zeroes can be felt ugly)
if you spot any glaring mistakes or improvements that could be made to this script, please feel free to advise
Well, your code is very perfect.
If you intend to change nature of display, perhaps you should look at PIL Imagefont getbbox and getlength https://pillow.readthedocs.io/en/stable ... eFont.html
(to center/justify when changing text/ font/ display....) But that would be overkill IMO, as the screen is very beautiful...

Statistics: Posted by dbrion1 — Tue Mar 26, 2024 7:35 pm



Viewing all articles
Browse latest Browse all 4762

Trending Articles