update python-escpos version

This commit is contained in:
samerbam 2023-08-22 22:32:59 -04:00
parent 050803a5b7
commit a12380ea8d
2 changed files with 8 additions and 6 deletions

View File

@ -17,7 +17,7 @@ from .thermal_print import ThermalPrinter
app = FastAPI() app = FastAPI()
auth = VerifyToken() auth = VerifyToken()
data = TodoDatabase() data = TodoDatabase()
printer = ThermalPrinter() printer = ThermalPrinter(data)

View File

@ -36,9 +36,9 @@ import wonderwords
from datetime import datetime from datetime import datetime
from .sudoku_generator import * # from .sudoku_generator import *
from .wordsearch_generator import WordSearch # from .wordsearch_generator import WordSearch
from .database import TodoDatabase from database import TodoDatabase
@ -47,7 +47,8 @@ class ThermalPrinter():
# self.p = printer.Usb(0x0416, 0x5011, 4, 0x81, 0x02) #initalize printer on raspberry pi # self.p = printer.Usb(0x0416, 0x5011, 4, 0x81, 0x02) #initalize printer on raspberry pi
self.database = database self.database = database
try: try:
self.p = Usb(0x0416, 0x5011, 4, 0x81, 0x02) #initalize printer on raspberry pi # self.p = Usb(0x0416, 0x5011, 4, 0x81, 0x02) #initalize printer on raspberry pi
self.p = Usb(idVendor=0x0416, idProduct=0x5011, usb_args=None, timeout=4 , in_ep=0x81, out_ep=0x02)
# pass # pass
except usb.core.NoBackendError as e: except usb.core.NoBackendError as e:
print(e) print(e)
@ -73,7 +74,8 @@ class ThermalPrinter():
def print_sudoku(self): def print_sudoku(self):
self.p.close() self.p.close()
self.p = Usb(0x0416, 0x5011, 4, 0x81, 0x02) # self.p = Usb(0x0416, 0x5011, None, 4, 0x81, 0x02)
self.p = Usb(idVendor=0x0416, idProduct=0x5011, usb_args=None, timeout=4 , in_ep=0x81, out_ep=0x02)
convert_to_image(generate_sudoku()) convert_to_image(generate_sudoku())
self.p.image("sudoku.png") self.p.image("sudoku.png")