fix some other .set() calls

This commit is contained in:
samerbam 2023-08-22 23:32:04 -04:00
parent 2d9146b121
commit 0301e35c08

View File

@ -80,7 +80,11 @@ class ThermalPrinter():
# 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.image("sudoku.png") self.p.image("sudoku.png")
self.p.close()
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):
q = self.database.get_random_quote() q = self.database.get_random_quote()
@ -91,6 +95,8 @@ class ThermalPrinter():
self.p.text(q[1]) self.p.text(q[1])
self.p.text("\n") self.p.text("\n")
self.p.set(align="left")
# pass #TODO: parse https://zenquotes.io/api/quotes (api limit is 5 req per 30 seconds) # pass #TODO: parse https://zenquotes.io/api/quotes (api limit is 5 req per 30 seconds)
@ -100,17 +106,15 @@ class ThermalPrinter():
words = r.random_words(15, include_parts_of_speech=["nouns", "verbs", "adjectives"]) words = r.random_words(15, include_parts_of_speech=["nouns", "verbs", "adjectives"])
w = WordSearch(','.join(words), 32, 16) w = WordSearch(','.join(words), 32, 16)
self.p.set(align="left", invert=True) self.p.set(align="left")
self.p.text("Word Search:") self.p.text("Word Search:")
self.p.text("\n") self.p.text("\n")
self.p.set(align="center", invert=False) self.p.set(align="center")
for x in w.grid: for x in w.grid:
self.p.text(''.join(x) + "\n") self.p.text(''.join(x) + "\n")
self.p.set(align="left", invert=True)
self.p.text("\nWords: \n") self.p.text("\nWords: \n")
self.p.set(align="left", invert=False)
wwords = textwrap.wrap(' '.join(words), 32) wwords = textwrap.wrap(' '.join(words), 32)
for word in wwords: for word in wwords:
# self.p.set(align="left") # self.p.set(align="left")