source code of /small-scripts/stackexchange/nuospin
Last modified | |
Lines | 76 |
Parent directory Download CGIread sitemap Main page
Quick links: printline
#!/usr/bin/python
import sys
# Each item in `font` is a list of `font_height` strings.
# The glyphs are not limited to asterisks and spaces.
font_height = 7
margin_left = 1
margin_right = 1
font = {
'N': [
"* *",
"* *",
"** *",
"* * *",
"* **",
"* *",
"* *",
],
'U': [
"* *",
"* *",
"* *",
"* *",
"* *",
"* *",
" *** ",
],
'O': [
" *** ",
"* *",
"* *",
"* *",
"* *",
"* *",
" *** ",
],
'S': [
" *** ",
"* *",
"* ",
" *** ",
" *",
"* *",
" *** ",
],
'P': [
"**** ",
"* *",
"* *",
"**** ",
"* ",
"* ",
"* ",
],
'I': [
" * ",
" * ",
" * ",
" * ",
" * ",
" * ",
" * ",
],
}
def printline(text):
for row in range(font_height):
for ch in text:
sys.stdout.write(' ' * margin_left)
sys.stdout.write(font[ch][row])
sys.stdout.write(' ' * margin_right)
sys.stdout.write('\n')
printline('NUOSPIN')