Explicitly clear pixels next to time dots
This commit is contained in:
parent
e1e6878923
commit
5f58121e47
|
@ -17,6 +17,7 @@ class CharacterDisplay:
|
||||||
self.unicorn = unicorn
|
self.unicorn = unicorn
|
||||||
self.minX = minX
|
self.minX = minX
|
||||||
self.maxX = maxX
|
self.maxX = maxX
|
||||||
|
self.black = [0, 0, 0]
|
||||||
|
|
||||||
self.digits = {
|
self.digits = {
|
||||||
0: self.displayZero,
|
0: self.displayZero,
|
||||||
|
@ -32,23 +33,26 @@ class CharacterDisplay:
|
||||||
}
|
}
|
||||||
|
|
||||||
def displayDigit(self, x, y, digit, color):
|
def displayDigit(self, x, y, digit, color):
|
||||||
|
self.clearDigit(x, y)
|
||||||
self.digits[digit](x, y, color)
|
self.digits[digit](x, y, color)
|
||||||
self.unicorn.show()
|
self.unicorn.show()
|
||||||
|
|
||||||
def clearDigit(self, x, y):
|
def clearDigit(self, x, y):
|
||||||
for y1 in range(y, y-5, -1):
|
for y1 in range(y, y-5, -1):
|
||||||
for x1 in range(x, x+3):
|
for x1 in range(x, x+3):
|
||||||
self.setPixel(x1, y1, [0, 0, 0])
|
self.setPixel(x1, y1, self.black)
|
||||||
|
|
||||||
self.unicorn.show()
|
self.unicorn.show()
|
||||||
|
|
||||||
def displayTimeDots(self, x, y, color):
|
def displayTimeDots(self, x, y, color):
|
||||||
|
self.setPixel(x, y, self.black)
|
||||||
self.setPixel(x, y-1, color)
|
self.setPixel(x, y-1, color)
|
||||||
|
self.setPixel(x, y-2, self.black)
|
||||||
self.setPixel(x, y-3, color)
|
self.setPixel(x, y-3, color)
|
||||||
|
self.setPixel(x, y-4, self.black)
|
||||||
self.unicorn.show()
|
self.unicorn.show()
|
||||||
|
|
||||||
def displayZero(self, x, y, color):
|
def displayZero(self, x, y, color):
|
||||||
self.clearDigit(x, y)
|
|
||||||
self.fullLine(x, y, color)
|
self.fullLine(x, y, color)
|
||||||
self.bothSides(x, y-1, color)
|
self.bothSides(x, y-1, color)
|
||||||
self.bothSides(x, y-2, color)
|
self.bothSides(x, y-2, color)
|
||||||
|
@ -56,7 +60,6 @@ class CharacterDisplay:
|
||||||
self.fullLine(x, y-4, color)
|
self.fullLine(x, y-4, color)
|
||||||
|
|
||||||
def displayOne(self, x, y, color):
|
def displayOne(self, x, y, color):
|
||||||
self.clearDigit(x, y)
|
|
||||||
self.rightSide(x, y, color)
|
self.rightSide(x, y, color)
|
||||||
self.rightSide(x, y-1, color)
|
self.rightSide(x, y-1, color)
|
||||||
self.rightSide(x, y-2, color)
|
self.rightSide(x, y-2, color)
|
||||||
|
@ -64,7 +67,6 @@ class CharacterDisplay:
|
||||||
self.rightSide(x, y-4, color)
|
self.rightSide(x, y-4, color)
|
||||||
|
|
||||||
def displayTwo(self, x, y, color):
|
def displayTwo(self, x, y, color):
|
||||||
self.clearDigit(x, y)
|
|
||||||
self.fullLine(x, y, color)
|
self.fullLine(x, y, color)
|
||||||
self.rightSide(x, y-1, color)
|
self.rightSide(x, y-1, color)
|
||||||
self.fullLine(x, y-2, color)
|
self.fullLine(x, y-2, color)
|
||||||
|
@ -72,7 +74,6 @@ class CharacterDisplay:
|
||||||
self.fullLine(x, y-4, color)
|
self.fullLine(x, y-4, color)
|
||||||
|
|
||||||
def displayThree(self, x, y, color):
|
def displayThree(self, x, y, color):
|
||||||
self.clearDigit(x, y)
|
|
||||||
self.fullLine(x, y, color)
|
self.fullLine(x, y, color)
|
||||||
self.rightSide(x, y-1, color)
|
self.rightSide(x, y-1, color)
|
||||||
self.fullLine(x, y-2, color)
|
self.fullLine(x, y-2, color)
|
||||||
|
@ -80,7 +81,6 @@ class CharacterDisplay:
|
||||||
self.fullLine(x, y-4, color)
|
self.fullLine(x, y-4, color)
|
||||||
|
|
||||||
def displayFour(self, x, y, color):
|
def displayFour(self, x, y, color):
|
||||||
self.clearDigit(x, y)
|
|
||||||
self.bothSides(x, y, color)
|
self.bothSides(x, y, color)
|
||||||
self.bothSides(x, y-1, color)
|
self.bothSides(x, y-1, color)
|
||||||
self.fullLine(x, y-2, color)
|
self.fullLine(x, y-2, color)
|
||||||
|
@ -88,7 +88,6 @@ class CharacterDisplay:
|
||||||
self.rightSide(x, y-4, color)
|
self.rightSide(x, y-4, color)
|
||||||
|
|
||||||
def displayFive(self, x, y, color):
|
def displayFive(self, x, y, color):
|
||||||
self.clearDigit(x, y)
|
|
||||||
self.fullLine(x, y, color)
|
self.fullLine(x, y, color)
|
||||||
self.leftSide(x, y-1, color)
|
self.leftSide(x, y-1, color)
|
||||||
self.fullLine(x, y-2, color)
|
self.fullLine(x, y-2, color)
|
||||||
|
@ -96,7 +95,6 @@ class CharacterDisplay:
|
||||||
self.fullLine(x, y-4, color)
|
self.fullLine(x, y-4, color)
|
||||||
|
|
||||||
def displaySix(self, x, y, color):
|
def displaySix(self, x, y, color):
|
||||||
self.clearDigit(x, y)
|
|
||||||
self.fullLine(x, y, color)
|
self.fullLine(x, y, color)
|
||||||
self.leftSide(x, y-1, color)
|
self.leftSide(x, y-1, color)
|
||||||
self.fullLine(x, y-2, color)
|
self.fullLine(x, y-2, color)
|
||||||
|
@ -104,7 +102,6 @@ class CharacterDisplay:
|
||||||
self.fullLine(x, y-4, color)
|
self.fullLine(x, y-4, color)
|
||||||
|
|
||||||
def displaySeven(self, x, y, color):
|
def displaySeven(self, x, y, color):
|
||||||
self.clearDigit(x, y)
|
|
||||||
self.fullLine(x, y, color)
|
self.fullLine(x, y, color)
|
||||||
self.rightSide(x, y-1, color)
|
self.rightSide(x, y-1, color)
|
||||||
self.rightSide(x, y-2, color)
|
self.rightSide(x, y-2, color)
|
||||||
|
@ -112,7 +109,6 @@ class CharacterDisplay:
|
||||||
self.rightSide(x, y-4, color)
|
self.rightSide(x, y-4, color)
|
||||||
|
|
||||||
def displayEight(self, x, y, color):
|
def displayEight(self, x, y, color):
|
||||||
self.clearDigit(x, y)
|
|
||||||
self.fullLine(x, y, color)
|
self.fullLine(x, y, color)
|
||||||
self.bothSides(x, y-1, color)
|
self.bothSides(x, y-1, color)
|
||||||
self.fullLine(x, y-2, color)
|
self.fullLine(x, y-2, color)
|
||||||
|
@ -120,7 +116,6 @@ class CharacterDisplay:
|
||||||
self.fullLine(x, y-4, color)
|
self.fullLine(x, y-4, color)
|
||||||
|
|
||||||
def displayNine(self, x, y, color):
|
def displayNine(self, x, y, color):
|
||||||
self.clearDigit(x, y)
|
|
||||||
self.fullLine(x, y, color)
|
self.fullLine(x, y, color)
|
||||||
self.bothSides(x, y-1, color)
|
self.bothSides(x, y-1, color)
|
||||||
self.fullLine(x, y-2, color)
|
self.fullLine(x, y-2, color)
|
||||||
|
|
Loading…
Reference in New Issue