Skip to content

Instantly share code, notes, and snippets.

spring is coming


spring is coming
View GitHub Profile
xiaopc /
Last active Feb 16, 2021
Draw a table using only Pillow
from PIL import Image, ImageFont, ImageDraw
from collections import namedtuple
def position_tuple(*args):
Position = namedtuple('Position', ['top', 'right', 'bottom', 'left'])
if len(args) == 0:
return Position(0, 0, 0, 0)
elif len(args) == 1:
return Position(args[0], args[0], args[0], args[0])