From b68b3dc6c0768f96de5446d795f6447f19b91f1d Mon Sep 17 00:00:00 2001 From: freeyoung Date: Fri, 14 Mar 2014 01:51:14 +0800 Subject: [PATCH] import Image from PIL, or Pillow --- escpos/escpos.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/escpos/escpos.py b/escpos/escpos.py index 85be2e3..3389c93 100644 --- a/escpos/escpos.py +++ b/escpos/escpos.py @@ -6,11 +6,11 @@ @license: GPL ''' -import Image import qrcode import time import os import operator +from PIL import Image from constants import * from exceptions import * @@ -37,7 +37,7 @@ class Escpos: i = 0 cont = 0 buffer = "" - + self._raw(S_RASTER_N) buffer = "%02X%02X%02X%02X" % (((size[0]/size[1])/8), 0, size[1], 0) self._raw(buffer.decode('hex')) @@ -135,7 +135,7 @@ class Escpos: break elif im_color > (255 * 3 / pattern_len * pattern_len) and im_color <= (255 * 3): pix_line += im_pattern[-1] - break + break pix_line += im_right img_size[0] += im_border[1] @@ -177,9 +177,9 @@ class Escpos: self._raw(BARCODE_TXT_BTH) elif pos.upper() == "ABOVE": self._raw(BARCODE_TXT_ABV) - else: # DEFAULT POSITION: BELOW + else: # DEFAULT POSITION: BELOW self._raw(BARCODE_TXT_BLW) - # Type + # Type if bc.upper() == "UPC-A": self._raw(BARCODE_UPC_A) elif bc.upper() == "UPC-E": @@ -202,7 +202,7 @@ class Escpos: else: raise exception.BarcodeCodeError() - + def text(self, txt): """ Print alpha-numeric text """ if txt: