[Tutor] Alphabet lookup table

Phil phillor9 at gmail.com
Fri Jan 28 00:35:33 EST 2022


I have a 5 x 7 font lookup table class method that returns five hex 
values for a character. So far I've only created six entries and being 
basically lazy I'm wondering if something like this has already been 
created, failing that, is this the correct way to go about it anyway?

An Internet search didn't reveal such a module.

class Alphabet:
     def __init__(self):
         self.alpha_table = {'P': ['0x7f', '0x09', '0x09', '0x09', '0x06'],
                                        'H': ['0x7f', '0x08', '0x08', 
'0x08', '0x7f'],
                                        'I': ['0x00', '0x41', '0x7f', 
'0x41', '0x00'],
                                        'L': ['0x7f', '0x40', '0x40', 
'0x40', '0x40'],
                                        '.': ['0x00', '0x60', '0x60', 
'0x00', '0x00'],
                                        ' ': ['0x00', '0x00', '0x00', 
'0x00', '0x00']
                                       }

     def get_char(self, char):
         return self.alpha_table[char]

-- 
Regards,
Phil



More information about the Tutor mailing list