This commit is contained in:
Neythen 2021-05-23 11:28:46 +01:00
parent 21e421f4a3
commit 160e5fe7d9
7 changed files with 14 additions and 11 deletions

View File

@ -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

1 name current 24hr change
2 bitcoin 34484 35261 -6.042010140586837 -5.084112872371386
3 ethereum 2038.77 2108.24 -12.44588779457297 -9.88629261347141

View File

@ -1 +1 @@
23/05/2021 05:14:57
23/05/2021 06:28:24

1 23/05/2021 05:14:57 23/05/2021 06:28:24

View File

@ -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

1 name current opening
15 G 44.12 44.3
16 GDDY 79.08 81.3
17 GNRC 308.68 311.12
18 PEP 147.1 147.8734 147.873
19 STM 36.21 36.41
20 YELP 37.92 38.3
21 XRAY 67.48 68.01

BIN
final.ppm

Binary file not shown.

Binary file not shown.

View File

@ -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()