From b5349960e51b007e3cd0c6530321b8462b35cf33 Mon Sep 17 00:00:00 2001 From: Romain Porte Date: Sun, 23 Jul 2017 10:47:41 +0200 Subject: [PATCH] Let the user print stuff using qr example --- examples/qr_code.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/examples/qr_code.py b/examples/qr_code.py index 1fe8448..6db8b68 100644 --- a/examples/qr_code.py +++ b/examples/qr_code.py @@ -1,16 +1,19 @@ +import sys + from escpos.printer import Usb +def usage(): + print("usage: qr_code.py ") + + if __name__ == '__main__': + if len(sys.argv) != 2: + usage() + sys.exit(1) + + content = sys.argv[1] # Adapt to your needs p = Usb(0x0416, 0x5011, profile="POS-5890") - - # Some software barcodes - p.set(align='left') - - p.text("hello\n") - - p.qr("https://github.com/python-escpos/python-escpos") - - p.text("world\n") \ No newline at end of file + p.qr(content)