16 lines
494 B
Python
16 lines
494 B
Python
import escpos.printer
|
|
|
|
# Update this to match your printer's device path
|
|
PRINTER_DEVICE = "/dev/ttyUSB0"
|
|
|
|
class KanbanPrinter:
|
|
def __init__(self, device=PRINTER_DEVICE):
|
|
self.device = device
|
|
|
|
def print_task(self, content: str):
|
|
try:
|
|
printer = escpos.printer.Serial(devfile=self.device, baudrate=19200, timeout=1)
|
|
printer.text(f"Task: {content}\n")
|
|
printer.cut()
|
|
except Exception as e:
|
|
print(f"Printer error: {e}")
|