PrintLarge
From Wiki of the E-Business and Web Science Research Group
printlarge.py
This is an example of how bitmap fonts work. It can also be used to display decimal values in a very large font on simple terminals.
Result
#!/usr/bin/env python # encoding: utf-8 """ printlarge.py A simple example of how bitmap fonts work. Created by Martin Hepp on 2009-11-17 http://www.heppnetz.de """ # The following Python dictionary holds the graphical patterns for each digit and the comma. font = {'0':( '****', '* *', '* *', '* *', '* *', '* *', '****'), '1':( ' * ', ' * ', ' * ', ' * ', ' * ', ' * ', ' * '), '2':( '****', ' *', ' *', '****', '* ', '* ', '****'), '3':( '****', ' *', ' *', '****', ' *', ' *', '****'), '4':( '* *', '* *', '* *', '****', ' *', ' *', ' *'), '5':( '****', '* ', '* ', '****', ' *', ' *', '****'), '6':( '* ', '* ', '* ', '****', '* *', '* *', '****'), '7':( '****', ' *', ' *', ' *', ' *', ' *', ' *'), '8':( '****', '* *', '* *', '****', '* *', '* *', '****'), '9':( '****', '* *', '* *', '****', ' *', ' *', ' *'), ',':( ' ', ' ', ' ', ' ', ' ** ', ' ** ', ' ** ') } # main program text = "199,49" # define number to be displayed rows = ["","","","","","",""] # seven empty strings representing each line of the output for char in text: pattern = font[char] for i in range(7): rows[i] += pattern[i] + " " for line in rows: print line
