#!/usr/bin/env python # -*- coding: euc-jp -*- import sys, pygame tenji = [ u'¥¢100000', u'¥¤101000', u'¥¦110000', u'¥¨111000', u'¥ª011000', u'¥«100001', u'¥­101001', u'¥¯110001', u'¥±111001', u'¥³011001', u'¥µ100101', u'¥·101101', u'¥¹110101', u'¥»111101', u'¥½011101', u'¥¿100110', u'¥Á101110', u'¥Ä110110', u'¥Æ111110', u'¥È011110', u'¥Ê100010', u'¥Ë101010', u'¥Ì110010', u'¥Í111010', u'¥Î011010', u'¥Ï100011', u'¥Ò101011', u'¥Õ110011', u'¥Ø111011', u'¥Û011011', u'¥Þ100111', u'¥ß101111', u'¥à110111', u'¥á111111', u'¥â011111', u'¥ä010010', u'', u'¥æ010011', u'', u'¥è010110', u'¥é100100', u'¥ê101100', u'¥ë110100', u'¥ì111100', u'¥í011100', u'¥ï000010', u'¥ð001010', u'', u'¥ñ001110', u'¥ò000110', u'¥ó000111', u'', u'', u'', u'', u'', u'', u'', u'', u'¥Ã001000', u'£±100000', u'£²101000', u'£³110000', u'£´110100', u'£µ100100', u'£¶111000', u'£·111100', u'£¸101100', u'£¹011000', u'£°011100', u'£á100000', u'£â101000', u'£ã110000', u'£ä110100', u'£å100100', u'£æ111000', u'£ç111100', u'£è101100', u'£é011000', u'£ê011100', u'£ë100010', u'£ì101010', u'£í110010', u'£î110110', u'£ï100110', u'£ð111010', u'£ñ111110', u'£ò101110', u'£ó011010', u'£ô011110', u'£õ100011', u'£ö101011', u'£÷011101', u'£ø110011', u'£ù110111', u'£ú100111', ] col = 10 fgcolor = (0,0,0) bgcolor = (255,255,255) fontfile = '/usr/share/fonts/truetype/kochi/kochi-gothic-subst.ttf' outputname = 'tenjiwp.bmp' def main(argv): import pygame pygame.init() pygame.display.set_mode((800,600)) display = pygame.display.get_surface() display.fill(bgcolor) font = pygame.font.Font(fontfile, 24) font2 = pygame.font.Font(fontfile, 8) on = font2.render(u'¡ü', 1, fgcolor, bgcolor) off = font2.render(u'¡½', 1, fgcolor, bgcolor) for (i,s) in enumerate(tenji): if not s: continue (x,y) = divmod(i, col) x0 = x*80+8 y0 = y*60+8 t = font.render(s[0], 1, fgcolor, bgcolor) display.blit(t, (x0,y0+6)) for (j,c) in enumerate(s[1:]): t = off if c == '1': t = on (y1,x1) = divmod(j, 2) display.blit(t, (x0+x1*10+30,y0+y1*10+8)) pygame.display.flip() pygame.time.wait(1000) pygame.image.save(display, outputname) return 0 if __name__ == '__main__': sys.exit(main(sys.argv))