print_single_mice.py 782 B

12345678910111213141516171819202122232425262728
  1. #!/bin/python
  2. import shimatta_label.label_image as li
  3. import shimatta_label.brother_ql_wrapper as ql_wrapper
  4. import sys
  5. def print_label():
  6. printer_model = 'QL-800'
  7. printer_connection = 'usb://0x04f9:0x209b'
  8. if len(sys.argv) < 4:
  9. print(f'Usage: {sys.argv[0]} <Heading> <Line2> <Line3>')
  10. heading = input('First (Bold Heading) Line:')
  11. line2 = input('Second Line:')
  12. line3 = input('Third line:')
  13. else:
  14. heading = sys.argv[1]
  15. line2 = sys.argv[2]
  16. line3 = sys.argv[3]
  17. label = li.MiceToiletLabel()
  18. label.put_text(heading, line2, line3)
  19. printer = ql_wrapper.BrotherQlPrinter(model=printer_model, printer_connection=printer_connection, label_format='12')
  20. printer.print_image(label.get_pillow_image(), cut=True, rotation=270)
  21. if __name__ == '__main__':
  22. print_label()