try fixing sudoku printer

This commit is contained in:
samerbam 2023-08-23 10:27:00 -04:00
parent 9b88a3b4fe
commit 8abf64a492

View File

@ -49,7 +49,7 @@ class ThermalPrinter():
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, profile="POS-5890") self.p = Usb(idVendor=0x0416, idProduct=0x5011, usb_args=None, timeout=4000 , in_ep=0x81, out_ep=0x02, profile="POS-5890")
# pass # pass
except usb.core.NoBackendError as e: except usb.core.NoBackendError as e:
print(e) print(e)
@ -107,14 +107,14 @@ class ThermalPrinter():
# self.p.text("\n") # self.p.text("\n")
def print_sudoku(self): def print_sudoku(self):
self.p.close() # self.p.close()
# self.p = Usb(0x0416, 0x5011, None, 4, 0x81, 0x02) # self.p = Usb(0x0416, 0x5011, None, 4, 0x81, 0x02)
self.p = Usb(idVendor=0x0416, idProduct=0x5011, usb_args=None, timeout=4000 , in_ep=0x81, out_ep=0x02, profile="POS-5890") # self.p = Usb(idVendor=0x0416, idProduct=0x5011, usb_args=None, timeout=4000 , in_ep=0x81, out_ep=0x02, profile="POS-5890")
convert_to_image(generate_sudoku()) convert_to_image(generate_sudoku())
self.p.set(align="center") self.p.set(align="center")
self.p.image("sudoku.png") self.p.image("sudoku.png")
self.p.close() # self.p.close()
self.p = Usb(idVendor=0x0416, idProduct=0x5011, usb_args=None, timeout=4 , in_ep=0x81, out_ep=0x02, profile="POS-5890") # self.p = Usb(idVendor=0x0416, idProduct=0x5011, usb_args=None, timeout=4 , in_ep=0x81, out_ep=0x02, profile="POS-5890")
def print_random_quote(self): def print_random_quote(self):