flickering update

This commit is contained in:
Neythen 2021-07-06 21:18:54 +01:00
parent 5db785d662
commit d87d703596

View File

@ -96,11 +96,13 @@ class StockTicker():
img_width, img_height = image.size img_width, img_height = image.size
pixels = image.load() pixels = image.load()
for y in range(max(0, -offset_y), min(img_height, self.matrix.height - offset_y)): for y in range(max(0, -offset_y), min(img_height, self.matrix.height - offset_y)):
for x in range(max(0, -offset_x), min(img_width, self.matrix.width - offset_x)): for x in range(max(0, -offset_x), min(img_width, self.matrix.width - offset_x)):
#print(x,y)
(r, g, b) = pixels[x, y]
if min_x <= x + offset_x <= max_x and min_y <= y + offset_y <= max_y: if min_x <= x + offset_x <= max_x and min_y <= y + offset_y <= max_y:
(r, g, b) = pixels[x, y]
self.matrix.SetPixel(x + offset_x, y + offset_y, r*self.brightness, g*self.brightness, b*self.brightness) self.matrix.SetPixel(x + offset_x, y + offset_y, r*self.brightness, g*self.brightness, b*self.brightness)
def scrollImage(self, image, offset_x = 0, offset_y = 0): def scrollImage(self, image, offset_x = 0, offset_y = 0):
@ -1807,7 +1809,8 @@ if __name__ == '__main__':
if kill: if kill:
break break
''' '''
#stock_ticker.process_msg(P') #
#stock_ticker.process_msg('N')
#stock_ticker.process_msg('G') #stock_ticker.process_msg('G')
#stock_ticker.process_msg('f') #stock_ticker.process_msg('f')
#stock_ticker.process_msg('A') #stock_ticker.process_msg('A')