Here a snippet for a 'quick hack' for large font. Not optimized *, but could be a quick solution for your display problem.
Add other chars as needed.* premature optimization is the root of all evil
Add other chars as needed.
Code:
class SomewhatLargerFont: def __init__(self): self.pixels = { '0': [ "..********..", # 0 ".*........*.", # 1 "*..........*", # 2 "*..........*", # 3 "*..........*", # 4 "*..........*", # 5 "*..........*", # 6 "*..........*", # 7 "*..........*", # 8 "*..........*", # 9 ".*........*.", # 10 "..********..", # 11 ], '1': [ ".....**.....", # 0 "....*.*.....", # 1 "...*..*.....", # 2 "......*.....", # 3 "......*.....", # 4 "......*.....", # 5 "......*.....", # 6 "......*.....", # 7 "......*.....", # 8 "......*.....", # 9 "......*.....", # 10 ".....***....", # 11 ], '2': [ "..********..", # 0 ".*........*.", # 1 "*..........*", # 2 "...........*", # 3 "..........*.", # 4 "........*...", # 5 "......*.....", # 6 "....*.......", # 7 "..*.........", # 8 "*...........", # 9 "*...........", # 10 "************", # 11 ], } def char ( self, display, c, x, y): if c in self.pixels: pixel_array = self.pixels[c] for x_ in range(12): for y_ in range(12): if pixel_array[y_][x_] == '*': display.pixel( x + x_, y+y_, 1) def text(self, display, text:str, x, y): for idx, c in enumerate(text): self.char( display, c, x + idx*15, y)Statistics: Posted by ghp — Wed Feb 19, 2025 7:54 am