From d8c1ad5c924a00fd64d254da8ef1a77229d24731 Mon Sep 17 00:00:00 2001
From: Robin Bijl <r.a.bijl@student.tudelft.nl>
Date: Thu, 23 May 2019 21:01:03 +0200
Subject: [PATCH] cleans up draw checkbox function a bit

---
 zesje/pdf_generation.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/zesje/pdf_generation.py b/zesje/pdf_generation.py
index ed4e5b2b..09bf9641 100644
--- a/zesje/pdf_generation.py
+++ b/zesje/pdf_generation.py
@@ -173,15 +173,15 @@ def generate_checkbox(canvas, x, y, label):
     margin = 5  # Margin between elements and sides
     markboxsize = fontsize - 2  # Size of checkboxes boxes
     x_label = x + 1  # location of the label
-    y_label = y  + margin  # remove fontsize from the y label since we draw from the bottom left up
-    box_y = y - markboxsize
+    y_label = y + margin  # remove fontsize from the y label since we draw from the bottom left up
+    box_y = y - markboxsize  # remove the markboxsize because the y is the coord of the top
+    # and reportlab prints from the bottom
+
     # check that there is a label to print
     if (label and not (len(label) == 0)):
         canvas.setFont('Helvetica', fontsize)
         canvas.drawString(x_label, y_label, label[0])
-        #box_y = box_y - margin - fontsize
 
-    # canvas.lines([ (x, y, x +15, y), (x, y, x, y +15)])
     canvas.rect(x, box_y, markboxsize, markboxsize)
 
 
-- 
GitLab