bug fix
This commit is contained in:
parent
21e421f4a3
commit
160e5fe7d9
Binary file not shown.
@ -1,3 +1,3 @@
|
|||||||
name,current,24hr change
|
name,current,24hr change
|
||||||
bitcoin,34484,-6.042010140586837
|
bitcoin,35261,-5.084112872371386
|
||||||
ethereum,2038.77,-12.44588779457297
|
ethereum,2108.24,-9.88629261347141
|
||||||
|
|
@ -1 +1 @@
|
|||||||
23/05/2021 05:14:57
|
23/05/2021 06:28:24
|
||||||
|
|
@ -15,7 +15,7 @@ ETSY,167.56,173
|
|||||||
G,44.12,44.3
|
G,44.12,44.3
|
||||||
GDDY,79.08,81.3
|
GDDY,79.08,81.3
|
||||||
GNRC,308.68,311.12
|
GNRC,308.68,311.12
|
||||||
PEP,147.1,147.8734
|
PEP,147.1,147.873
|
||||||
STM,36.21,36.41
|
STM,36.21,36.41
|
||||||
YELP,37.92,38.3
|
YELP,37.92,38.3
|
||||||
XRAY,67.48,68.01
|
XRAY,67.48,68.01
|
||||||
|
|
BIN
scroll_text.ppm
BIN
scroll_text.ppm
Binary file not shown.
@ -121,7 +121,7 @@ class StockTicker():
|
|||||||
offset_x -= 1
|
offset_x -= 1
|
||||||
|
|
||||||
self.setImage(image, offset_x = offset_x+128, offset_y = offset_y)
|
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:
|
try:
|
||||||
msg = getInput()
|
msg = getInput()
|
||||||
@ -203,18 +203,21 @@ class StockTicker():
|
|||||||
current_img = 1
|
current_img = 1
|
||||||
offset_x = 0
|
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
|
creates and returns a ppm image containing the text in the supplied font and colour
|
||||||
'''
|
'''
|
||||||
|
|
||||||
width, height = self.get_text_dimensions(text, font)
|
width, height = self.get_text_dimensions(text, font)
|
||||||
|
|
||||||
|
if matrix_height:
|
||||||
|
height = 32
|
||||||
print(text)
|
print(text)
|
||||||
print('dims:', width, height)
|
print('dims:', width, height)
|
||||||
img = Image.new('RGB', (width + 50, height))
|
img = Image.new('RGB', (width + 50, height))
|
||||||
d = ImageDraw.Draw(img)
|
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
|
return img
|
||||||
|
|
||||||
|
|
||||||
@ -233,7 +236,7 @@ class StockTicker():
|
|||||||
|
|
||||||
font = ImageFont.load("./fonts/texgyre-27.pil")
|
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')
|
img.save('scroll_text.ppm')
|
||||||
self.scrollImageTransition(['scroll_text.ppm', 'scroll_text.ppm'], offset_x = 128, offset_y = 0, stocks = False)
|
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):
|
def displayNews(self):
|
||||||
font = ImageFont.load("./fonts/8x13.pil")
|
font = ImageFont.load("./fonts/8x13B.pil")
|
||||||
while True:
|
while True:
|
||||||
headlines = []
|
headlines = []
|
||||||
f = open('csv/news.csv', 'r')
|
f = open('csv/news.csv', 'r')
|
||||||
@ -336,7 +339,7 @@ class StockTicker():
|
|||||||
|
|
||||||
text = text_string
|
text = text_string
|
||||||
white = (255,255,255)
|
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()
|
bbox = canvas.getbbox()
|
||||||
width = bbox[2]-bbox[0]
|
width = bbox[2]-bbox[0]
|
||||||
@ -583,7 +586,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
#print(sys.stdin.readlines())
|
#print(sys.stdin.readlines())
|
||||||
stock_ticker = StockTicker()
|
stock_ticker = StockTicker()
|
||||||
#stock_ticker.displayTextRepeating()
|
#stock_ticker.displayUserText()
|
||||||
#stock_ticker.process_msg('f')
|
#stock_ticker.process_msg('f')
|
||||||
|
|
||||||
#stock_ticker.displayNews()
|
#stock_ticker.displayNews()
|
||||||
|
Loading…
Reference in New Issue
Block a user