From e31b3137d9110ccb1646a4e9b54a30996db69a3d Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Mon, 10 Oct 2022 14:46:55 -0600 Subject: [PATCH] Adjust text positioning --- main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 2e28046..5dc61f1 100755 --- a/main.py +++ b/main.py @@ -176,8 +176,10 @@ def print_nametag(name, guest=False): quote = '' if guest: + quote_size = 120 quote = 'GUEST' else: + quote_size = 80 name_lookup = name.lower()[:4] if name_lookup in assigned_quotes: quote = assigned_quotes[name_lookup] @@ -187,7 +189,6 @@ def print_nametag(name, guest=False): assigned_quotes[name_lookup] = quote name_size = 305 - quote_size = 80 im = Image.open('label.png') width, height = im.size @@ -199,7 +200,7 @@ def print_nametag(name, guest=False): font = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', name_size) w, h = draw.textsize(name, font=font) - x, y = (width - w) / 2, (height - h) / 2 + x, y = (width - w) / 2, ((height - h) / 2) - 20 draw.text((x, y), name, font=font, fill='black') w = 9999 @@ -212,7 +213,7 @@ def print_nametag(name, guest=False): draw.text((x, y), quote, font=font, fill='black') im.save('tmp.png') - os.system('lp -d LabelWriter-450 tmp.png') + os.system('lp -d LabelWriter-450 tmp.png 2> /dev/null') def message_protovac(message):