-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewMessage.py
More file actions
executable file
·34 lines (29 loc) · 1003 Bytes
/
newMessage.py
File metadata and controls
executable file
·34 lines (29 loc) · 1003 Bytes
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
#!/usr/bin/python
# -*- coding:utf-8 -*-
import sys
import os
picdir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'pic')
libdir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'lib')
if os.path.exists(libdir):
sys.path.append(libdir)
import logging
from waveshare_epd import epd2in7
import time
from PIL import Image,ImageDraw,ImageFont
import traceback
logging.basicConfig(level=logging.DEBUG)
epd = epd2in7.EPD()
pinNum = 1
#def formatString(string):
def newMessageScreen():
font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24)
epd.init()
# Drawing on the Horizontal image
Himage = Image.new('1', (epd.height, epd.width), 0)
draw = ImageDraw.Draw(Himage)
draw.text((10, 0), "\n\n NEW MESSAGE\n FROM LUKE", font = font24, fill = 200)
epd.display(epd.getbuffer(Himage))
logging.info("Goto Sleep...")
epd.sleep()
newMessageScreen()
os.system("python buttonListener.py")