From 0941e35bcdf96eafa08816233098c7581314568e Mon Sep 17 00:00:00 2001 From: dherrada Date: Tue, 11 Feb 2020 14:45:33 -0500 Subject: [PATCH] Fixed label issues --- CircuitPython_Pyloton/pyloton.py | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/CircuitPython_Pyloton/pyloton.py b/CircuitPython_Pyloton/pyloton.py index 42188d4ee..9cb51e1fe 100644 --- a/CircuitPython_Pyloton/pyloton.py +++ b/CircuitPython_Pyloton/pyloton.py @@ -81,6 +81,8 @@ class Pyloton: status_heading = label.Label(font=self.arial16, x=80, y=175, text="Status", color=self.YELLOW) + status_heading.x = 80 + status_heading.y = 175 rect = Rect(0, 165, 240, 75, fill=self.PURPLE) @@ -112,14 +114,21 @@ class Pyloton: if len(message) > 25: status = label.Label(font=self.arial12, x=10, y=200, text=message[:25], color=self.YELLOW) + status.x = 10 + status.y = 200 status1 = label.Label(font=self.arial12, x=10, y=220, text=message[25:], color=self.YELLOW) + status1.x = 10 + status1.y = 220 text_group.append(status) text_group.append(status1) else: status = label.Label(font=self.arial12, x=10, y=200, text=message, color=self.YELLOW) + status.x = 10 + status.y = 200 text_group.append(status) + if len(self.loading_group) < 4: @@ -316,6 +325,8 @@ class Pyloton: self.splash.append(rect) heading = label.Label(font=self.arial24, x=55, y=25, text="PyLoton", color=self.YELLOW) + heading.x = 55 + heading.y = 25 self.splash.append(heading) if self.heart_enabled: @@ -345,14 +356,18 @@ class Pyloton: speed, cadence = self.read_s_and_c() if self.heart_enabled: - hr_label = self._label_maker('{} bpm'.format(heart), 50, 75) # 75 + hr_label = self._label_maker('{} bpm'.format(heart), 50, self.heart_y) # 75 + hr_label.x = 50 + hr_label.y = 75 if self.setup: self.splash[3] = hr_label else: self.splash.append(hr_label) if self.speed_enabled: - sp_label = self._label_maker('{} mph'.format(speed), 50, 120) # 120 + sp_label = self._label_maker('{} mph'.format(speed), 50, self.speed_y) # 120 + sp_label.x = 50 + sp_label.y = 120 if self.setup: self.splash[4] = sp_label else: @@ -360,15 +375,18 @@ class Pyloton: if self.cadence_enabled: - cad_label = self._label_maker('{} rpm'.format(cadence), 50, 165) # 165 + cad_label = self._label_maker('{} rpm'.format(cadence), 50, self.cad_y) # 165 + cad_label.x = 50 + cad_label.y = 165 if self.setup: self.splash[5] = cad_label else: self.splash.append(cad_label) if self.ams_enabled: - ams_label = self._label_maker('{}'.format(self.ams.title), 50, 210, font=self.arial16) # 210 - + ams_label = self._label_maker('{}'.format(self.ams.title), 50, self.ams_y, font=self.arial16) # 210 + ams_label.x = 50 + ams_label.y = 210 if self.setup: self.splash[6] = ams_label else: