forked from SvenBunge/tibber-eink-display
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chart_to_display.py
34 lines (26 loc) · 881 Bytes
/
chart_to_display.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import logging
from waveshare_epd import epd7in5b_V2
from PIL import Image
from create_price_chart import PriceChart
# Display waveshare debug messages
# logging.basicConfig(level=logging.DEBUG)
def schreibe_display():
epd = None
try:
epd = epd7in5b_V2.EPD()
logging.info("init and Clear")
epd.init()
epd.Clear()
#logging.info("4.read bmp file on window")
blk_img = Image.open("charts/chart_blk.png")
red_img = Image.open("charts/chart_red.png")
# blk_img, red_img = PriceChart().generate_chart()
epd.display(epd.getbuffer(blk_img), epd.getbuffer(red_img))
except IOError as e:
logging.info(e)
except KeyboardInterrupt:
logging.info("ctrl + c:")
finally:
epd.sleep()
epd7in5b_V2.epdconfig.module_exit()
schreibe_display()