grouping (tausender-punkt). color.
This commit is contained in:
parent
3d0e40c56e
commit
ba2eeeec81
1 changed files with 14 additions and 10 deletions
|
|
@ -3,6 +3,8 @@
|
|||
import time
|
||||
from PIL import Image, ImageDraw
|
||||
import lib.display
|
||||
import locale
|
||||
locale.setlocale(locale.LC_ALL, "de_DE.UTF-8")
|
||||
|
||||
# Replace with your free Finnhub API key
|
||||
API_KEY = "d3t8099r01qigeg1s7cgd3t8099r01qigeg1s7d0"
|
||||
|
|
@ -20,29 +22,31 @@ def start(stop_event, args):
|
|||
trend = None
|
||||
image_buffer = lib.display.matrix.buffer()
|
||||
draw = ImageDraw.Draw(image_buffer)
|
||||
#symbol = '⏶'
|
||||
symbol = '-'
|
||||
color = (255,255,255)
|
||||
|
||||
while not stop_event.is_set():
|
||||
# All to black
|
||||
draw.rectangle( ((0,0),(lib.display.matrix.width-1,lib.display.matrix.height-1)), fill=(0,0,0) )
|
||||
|
||||
price = get_bitcoin_price()
|
||||
price_str = locale.format_string("%d", price, grouping=True)
|
||||
|
||||
# Trend berechnen
|
||||
if last_price:
|
||||
if price > last_price:
|
||||
trend = 1
|
||||
#symbol = "🡅"
|
||||
symbol = "▴"
|
||||
color = (0, 255, 0)
|
||||
elif price < last_price:
|
||||
trend = -1
|
||||
#symbol = "🡇"
|
||||
symbol = "▾"
|
||||
color = (255, 0, 0)
|
||||
|
||||
#display.triangle(draw, 0, 0, trend, width=16, height=32)
|
||||
#print(symbol)
|
||||
text = f"{symbol} BTC: {price_str}€"
|
||||
#text = f"BTC: {price:.0f}€"
|
||||
|
||||
#text = f"{symbol} BTC: {price:.0f}€"
|
||||
text = f"BTC: {price:.0f}€"
|
||||
|
||||
draw.text((20, 0), text, fill=(255, 255, 255), font=lib.display.matrix.large_font)
|
||||
draw.text((10, 0), text, fill=color, font=lib.display.matrix.large_font)
|
||||
|
||||
lib.display.matrix.show(image_buffer)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue