diff --git a/final.ppm b/final.ppm index bc37859..a2f9e0f 100755 Binary files a/final.ppm and b/final.ppm differ diff --git a/final1.ppm b/final1.ppm index 3667075..a2f9e0f 100755 Binary files a/final1.ppm and b/final1.ppm differ diff --git a/stockTicker.py b/stockTicker.py index 503fd0f..3411e4a 100644 --- a/stockTicker.py +++ b/stockTicker.py @@ -16,7 +16,7 @@ import requests import pexpect from rgbmatrix import RGBMatrix, RGBMatrixOptions from rgbmatrix.graphics import * - +from multiprocessing import Process def getInput(Block=False): if Block or select.select([sys.stdin], [], [], 0) == ([sys.stdin], [], []): @@ -91,7 +91,7 @@ class StockTicker(): image = self.openImage(image_file) img_width, img_height = image.size - print(offset_x, offset_y) + while offset_x > -img_width: offset_x -= 1 @@ -107,14 +107,22 @@ class StockTicker(): while True: if current_img == 1: - if stocks: self.getFullStockImage(1) + + if stocks: + update_process = Process(target = self.getFullStockImage, args = (1,)) + update_process.start() image1 = self.openImage(image_files[0]) image2 = self.openImage(image_files[1]) + elif current_img == 2: - if stocks: self.getFullStockImage(2) + + if stocks: + update_process = Process(target = self.getFullStockImage, args = (2,)) + update_process.start() + image1 = self.openImage(image_files[1]) image2 = self.openImage(image_files[0]) - + img_width, img_height = image1.size @@ -143,7 +151,8 @@ class StockTicker(): if kill: break - + if stocks: + update_process.join() if current_img == 1: current_img = 2 elif current_img == 2: @@ -261,9 +270,7 @@ class StockTicker(): change = float(info[0])-float(info[1]) #TEXT ticker = symbol #TEXT current = '%.2f' % float(info[0]) #TEXT - - arrow, change = self.getArrow(change) change = '%.2f' % change midFrame = self.textToImage(ticker, current, change, arrow) #IMAGE THE TEXT @@ -332,7 +339,7 @@ class StockTicker(): CSV = csv.reader(f) next(CSV) for row in CSV: - print(row) + try: symbol, current_price, opening_price = row self.symbols.append(symbol) @@ -350,7 +357,7 @@ class StockTicker(): CSV = csv.reader(f) next(CSV) for row in CSV: - print(row) + try: coin, current_price, day_change = row self.coins.append(coin) @@ -432,7 +439,8 @@ if __name__ == '__main__': #stock_ticker.getFullStockImage(1) #stock_ticker.displayStocks() - + stock_ticker.delay = 0.001 + stock_ticker.scrollImageTransition(['final.ppm', 'final.ppm'], offset_x = 0, offset_y = 0) while True: msg = getInput()