From bbc7e505ae26b9843cfa56075df102009671ca63 Mon Sep 17 00:00:00 2001 From: Mike Cifelli <1836280-mike-cifelli@users.noreply.gitlab.com> Date: Tue, 27 Dec 2022 19:49:15 -0500 Subject: [PATCH] Show degree character in temperature --- character_display.py | 15 ++++++++++++++- time_display.py | 2 +- weather_display.py | 12 +++++++++--- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/character_display.py b/character_display.py index 3355e4a..5d50827 100644 --- a/character_display.py +++ b/character_display.py @@ -56,7 +56,7 @@ class CharacterDisplay: self.unicorn.show() - def displayTimeDots(self, x, y, color,): + def displayTimeDots(self, x, y, color): self.setPixel(x, y, colors.BLACK) self.setPixel(x, y-1, color) self.setPixel(x, y-2, colors.BLACK) @@ -64,6 +64,19 @@ class CharacterDisplay: self.setPixel(x, y-4, colors.BLACK) self.unicorn.show() + def displayDegree(self, x, y, color): + self.setPixel(x, y, color) + self.setPixel(x, y-1, color) + self.setPixel(x, y-2, colors.BLACK) + self.setPixel(x, y-3, colors.BLACK) + self.setPixel(x, y-4, colors.BLACK) + self.setPixel(x+1, y, color) + self.setPixel(x+1, y-1, color) + self.setPixel(x+1, y-2, colors.BLACK) + self.setPixel(x+1, y-3, colors.BLACK) + self.setPixel(x+1, y-4, colors.BLACK) + self.unicorn.show() + def displayNegative(self, x, y, color): self.setPixel(x, y, colors.BLACK) self.setPixel(x, y-1, colors.BLACK) diff --git a/time_display.py b/time_display.py index 979f715..1f939fd 100644 --- a/time_display.py +++ b/time_display.py @@ -11,7 +11,7 @@ class TimeDisplay: self.currentHour = [-1, -1] self.currentMinute = [-1, -1] self.currentColor = colors.BLACK - self.color = colors.RED + self.color = colors.PINK self.hourStartColumn = -1 self.timeDotsColumn = 7 self.minuteStartColumn = 9 diff --git a/weather_display.py b/weather_display.py index 9d0c63f..ec5dd68 100644 --- a/weather_display.py +++ b/weather_display.py @@ -5,11 +5,11 @@ class WeatherDisplay: def __init__(self, characterDisplay, topRow): self.characterDisplay = characterDisplay self.topRow = topRow - self.twoDigitStartColumn = 9 - self.oneDigitStartColumn = 13 + self.twoDigitStartColumn = 6 + self.oneDigitStartColumn = 10 self.digitWidth = 4 self.currentTemperature = '' - self.color = colors.PINK + self.color = colors.BLUE self.weatherFile = 'weather.txt' def showWeather(self): @@ -52,6 +52,12 @@ class WeatherDisplay: ) start = start + self.digitWidth + self.characterDisplay.displayDegree( + x=start, + y=self.topRow, + color=self.color + ) + def getStartColumn(self, temperature): return self.oneDigitStartColumn if (self.isOneDigit(temperature)) else self.twoDigitStartColumn