transition

This commit is contained in:
Neythen 2021-05-04 22:36:40 +01:00
parent bb4f2356de
commit a962199727

View File

@ -104,50 +104,50 @@ class StockTicker():
current_img = 1 current_img = 1
#while True: while True:
if current_img == 1: if current_img == 1:
image = self.openImage(image_files[0]) image = self.openImage(image_files[0])
elif current_img == 2: elif current_img == 2:
image = self.openImage(image_files[1]) image = self.openImage(image_files[1])
img_width, img_height = image.size img_width, img_height = image.size
while offset_x > -img_width: while offset_x > -img_width:
offset_x -= 1 offset_x -= 1
self.setImage(image, offset_x = offset_x, offset_y = offset_y) self.setImage(image, offset_x = offset_x, offset_y = offset_y)
time.sleep(self.delay) time.sleep(self.delay)
try: try:
msg = getInput() msg = getInput()
if msg == 'K': if msg == 'K':
self.resetMatrix() self.resetMatrix()
break break
elif msg == 's': elif msg == 's':
stock_ticker.delay = 0.03 stock_ticker.delay = 0.03
elif msg == 'm': elif msg == 'm':
stock_ticker.delay = 0.01 stock_ticker.delay = 0.01
elif msg == 'f': elif msg == 'f':
stock_ticker.delay = 0.005 stock_ticker.delay = 0.005
elif msg in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']: elif msg in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']:
self.brightness = min(1.0, float(msg)/10 + 0.1) self.brightness = min(1.0, float(msg)/10 + 0.1)
except KeyboardInterrupt: except KeyboardInterrupt:
sys.stdout.flush() sys.stdout.flush()
pass pass
if current_img == 1: if current_img == 1:
current_img = 2 current_img = 2
elif current_img == 2: elif current_img == 2:
current_img = 1 current_img = 1
offset_x = 0 offset_x = 0
#Get the logo from file that is the same as ticker name #Get the logo from file that is the same as ticker name
def getLogo(self, Ticker): def getLogo(self, Ticker):