0

誰かがサーマル印刷を手伝ってくれませんか。それで、QRコードを正常に生成し、USBサーマルプリンターを介してQRコードを印刷しました. しかし、私が望むのは、QR コードの横に別のテキストを印刷することだけです。github の python-escpos ライブラリを使用します。

これが私のコードです:

from escpos import *
import qrcode
import sys

from PIL import Image
qr = qrcode.QRCode(
    version=1,
    error_correction=qrcode.constants.ERROR_CORRECT_L,
    box_size=8,
    border=1,
)
#get the string from sys.argv to store in QR Code
list = sys.argv 
y=0;
#define the printer
E = printer.Usb(0x0416,0xaabb) 

for x in list:
        #to ignore some args
        if(y!=0): 
                #make the QR Code
                qr.clear()
                qr.add_data(x)
                qr.make()

                #generating QR Code
                im = qr.make_image() 
                #Saving the QR Code to current path
                im.save(str(x)+'.png') 
                #printing the QR Code
                E.image(str(x)+'.png') 
        else:
                y=y+1
4

0 に答える 0