diff --git a/__pycache__/stockTicker.cpython-37.pyc b/__pycache__/stockTicker.cpython-37.pyc index dd972e0..570cc2a 100644 Binary files a/__pycache__/stockTicker.cpython-37.pyc and b/__pycache__/stockTicker.cpython-37.pyc differ diff --git a/csv/crypto.csv b/csv/crypto.csv index d6b5f11..6c78219 100644 --- a/csv/crypto.csv +++ b/csv/crypto.csv @@ -1,3 +1,3 @@ name,current,24hr change -bitcoin,34484,-6.042010140586837 -ethereum,2038.77,-12.44588779457297 +bitcoin,35261,-5.084112872371386 +ethereum,2108.24,-9.88629261347141 diff --git a/csv/last_update.csv b/csv/last_update.csv index ce65959..270fbb6 100644 --- a/csv/last_update.csv +++ b/csv/last_update.csv @@ -1 +1 @@ -23/05/2021 05:14:57 +23/05/2021 06:28:24 diff --git a/csv/tickers.csv b/csv/tickers.csv index 0311acc..729e6b8 100644 --- a/csv/tickers.csv +++ b/csv/tickers.csv @@ -15,7 +15,7 @@ ETSY,167.56,173 G,44.12,44.3 GDDY,79.08,81.3 GNRC,308.68,311.12 -PEP,147.1,147.8734 +PEP,147.1,147.873 STM,36.21,36.41 YELP,37.92,38.3 XRAY,67.48,68.01 diff --git a/final.ppm b/final.ppm index 6251b2f..fb88368 100755 Binary files a/final.ppm and b/final.ppm differ diff --git a/scroll_text.ppm b/scroll_text.ppm index cadb84d..e555804 100755 Binary files a/scroll_text.ppm and b/scroll_text.ppm differ diff --git a/stockTicker.py b/stockTicker.py index 5fc244e..6a72a85 100644 --- a/stockTicker.py +++ b/stockTicker.py @@ -121,7 +121,7 @@ class StockTicker(): offset_x -= 1 self.setImage(image, offset_x = offset_x+128, offset_y = offset_y) - self.setImage(image, offset_x = offset_x, offset_y = offset_y+16) + self.setImage(image, offset_x = offset_x, offset_y = offset_y+20) try: msg = getInput() @@ -203,18 +203,21 @@ class StockTicker(): current_img = 1 offset_x = 0 - def textImage(self, text, font, r = 255, g = 255, b = 255): + def textImage(self, text, font, r = 255, g = 255, b = 255, matrix_height = False): ''' creates and returns a ppm image containing the text in the supplied font and colour ''' width, height = self.get_text_dimensions(text, font) + + if matrix_height: + height = 32 print(text) print('dims:', width, height) img = Image.new('RGB', (width + 50, height)) d = ImageDraw.Draw(img) - d.text((4, 0), text, fill=(r, g, b), font=font) + d.text((0, 0), text, fill=(r, g, b), font=font) return img @@ -233,7 +236,7 @@ class StockTicker(): font = ImageFont.load("./fonts/texgyre-27.pil") - img = self.textImage(text, font, int(r), int(g), int(b)) + img = self.textImage(text, font, int(r), int(g), int(b), True) img.save('scroll_text.ppm') self.scrollImageTransition(['scroll_text.ppm', 'scroll_text.ppm'], offset_x = 128, offset_y = 0, stocks = False) @@ -245,7 +248,7 @@ class StockTicker(): def displayNews(self): - font = ImageFont.load("./fonts/8x13.pil") + font = ImageFont.load("./fonts/8x13B.pil") while True: headlines = [] f = open('csv/news.csv', 'r') @@ -336,7 +339,7 @@ class StockTicker(): text = text_string white = (255,255,255) - draw.text((10, 10), text, font=monospace, fill=white) + draw.text((0, 0), text, font=monospace, fill=white) bbox = canvas.getbbox() width = bbox[2]-bbox[0] @@ -583,7 +586,7 @@ if __name__ == '__main__': #print(sys.stdin.readlines()) stock_ticker = StockTicker() - #stock_ticker.displayTextRepeating() + #stock_ticker.displayUserText() #stock_ticker.process_msg('f') #stock_ticker.displayNews()