kac/printer.py

17 lines
359 B
Python
Raw Normal View History

2022-11-04 01:51:04 +00:00
import StarTSPImage
from PIL import Image, ImageDraw, ImageFont, ImageOps
import textwrap
import random
def printer():
im = Image.new("RGB", (800, 1280), (0, 0, 0))
# im.show()
raster = StarTSPImage.imageToRaster(im, cut=True)
printer = open('/dev/usb/lp0', "wb")
printer.write(raster)
if __name__ == "__main__":
printer()