import os SHIFTED = ["exclamation","speech","pound","dollar","percent","caret","ampersand", "asterisk","openbracket","closebracket"] SHIFTED += [l for l in "QWERTYUIOPASDFGHJKL"] SHIFTED += ["delete"] SHIFTED += [l for l in "ZXCVBNM"] SHIFTED += ["openangle","closeangle","downshift","semicolon","space","discard", "discard","discard","discard","plus","colon","hash","ok"] UNSHIFTED = [l for l in "1234567890qwertyuiopasdfghjkl"] UNSHIFTED += ["delete"] UNSHIFTED += [l for l in "zxcvbnm"] UNSHIFTED += ["dot","comma","upshift","at","space","discard", "discard","discard","discard","dash","apostrophe","speech","ok"] SHIFTEDBASECMD = "convert uppercase_expanded_keyboard.png -crop %sx62+%s+%s keys/%s.png" UNSHIFTEDBASECMD = "convert lowercase_expanded_keyboard.png -crop %sx62+%s+%s keys/%s.png" def make_small_images(charlist, basecmd): for row in range(5): for col in range(10): rowpx = 65 + (row * 64) colpx = 1 + (col * 24) item = (row * 10) + col itemname = charlist[item] # special handling for space bar if itemname == "space": widthpx = 118 elif itemname == "discard": continue else: widthpx = 22 cmd = basecmd % (widthpx, colpx, rowpx, itemname) os.system(cmd) if __name__ == "__main__": make_small_images(SHIFTED, SHIFTEDBASECMD) make_small_images(UNSHIFTED, UNSHIFTEDBASECMD)