From d477dece3046ac7994add80d553adb44ce5133f5 Mon Sep 17 00:00:00 2001 From: UP929312 <36114463+UP929312@users.noreply.github.com> Date: Thu, 9 Jun 2022 15:16:28 +0100 Subject: [PATCH] Minor improvements --- code/humanImager.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/code/humanImager.py b/code/humanImager.py index 4bcdf32..d1d5174 100644 --- a/code/humanImager.py +++ b/code/humanImager.py @@ -32,18 +32,17 @@ def renderTextCenteredAt(text, font, colour, x, y, screen, allowed_width): # we'll render each line below the last, so we need to keep track of # the culmative height of the lines we've rendered so far y_offset = 40 - for i in range(len(lines)): - fw, fh = font.size(lines[i]) + for i, line in enumerate(lines): + fw, fh = font.size(line) # (tx, ty) is the top-left of the font surface tx = x - fw / 2 ty = y + y_offset*i - font_surface = font.render(lines[i], True, colour) + font_surface = font.render(line, True, colour) screen.blit(font_surface, (tx, ty)) - parser = argparse.ArgumentParser(description='blah') parser.add_argument('--input_file', type=str, help='the script') args = parser.parse_args()