From 0301e35c0871862b59c6308a0f8bfbad55fd5bdf Mon Sep 17 00:00:00 2001 From: samerbam Date: Tue, 22 Aug 2023 23:32:04 -0400 Subject: [PATCH] fix some other .set() calls --- application/thermal_print.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/application/thermal_print.py b/application/thermal_print.py index ed84592..44487c9 100644 --- a/application/thermal_print.py +++ b/application/thermal_print.py @@ -80,7 +80,11 @@ class ThermalPrinter(): # 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") convert_to_image(generate_sudoku()) + self.p.set(align="center") 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): q = self.database.get_random_quote() @@ -91,6 +95,8 @@ class ThermalPrinter(): self.p.text(q[1]) 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) @@ -100,17 +106,15 @@ class ThermalPrinter(): words = r.random_words(15, include_parts_of_speech=["nouns", "verbs", "adjectives"]) 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("\n") - self.p.set(align="center", invert=False) + self.p.set(align="center") for x in w.grid: self.p.text(''.join(x) + "\n") - self.p.set(align="left", invert=True) self.p.text("\nWords: \n") - self.p.set(align="left", invert=False) wwords = textwrap.wrap(' '.join(words), 32) for word in wwords: # self.p.set(align="left")