|
@@ -1,14 +1,16 @@
|
|
|
|
|
+#!/usr/bin/env python3
|
|
|
|
|
+#
|
|
|
|
|
|
|
|
def main():
|
|
def main():
|
|
|
import logging
|
|
import logging
|
|
|
from waveshare_epd import epd2in13_V2
|
|
from waveshare_epd import epd2in13_V2
|
|
|
import time
|
|
import time
|
|
|
from PIL import Image,ImageDraw
|
|
from PIL import Image,ImageDraw
|
|
|
|
|
+ import simpilib
|
|
|
|
|
|
|
|
import os
|
|
import os
|
|
|
fontpath = os.path.realpath(os.path.join(__file__,"..","..","wavesharelib","pic", 'Font.ttc'))
|
|
fontpath = os.path.realpath(os.path.join(__file__,"..","..","wavesharelib","pic", 'Font.ttc'))
|
|
|
|
|
|
|
|
- import simpilib
|
|
|
|
|
|
|
|
|
|
text = simpilib.getQuote()
|
|
text = simpilib.getQuote()
|
|
|
|
|
|
|
@@ -23,10 +25,14 @@ def main():
|
|
|
font = simpilib.loadFontSize(text, draw, image, fontpath)
|
|
font = simpilib.loadFontSize(text, draw, image, fontpath)
|
|
|
|
|
|
|
|
w, h = draw.textsize(text, font=font)
|
|
w, h = draw.textsize(text, font=font)
|
|
|
- center = (
|
|
|
|
|
|
|
+
|
|
|
|
|
+ # epd parameters are rotated 90°
|
|
|
|
|
+ center = [
|
|
|
int((epd.height-w)/2),
|
|
int((epd.height-w)/2),
|
|
|
int((epd.width-h)/2)
|
|
int((epd.width-h)/2)
|
|
|
- )
|
|
|
|
|
|
|
+ ]
|
|
|
|
|
+ # leave some space for low characters
|
|
|
|
|
+ center[1] = center[1] - 5
|
|
|
|
|
|
|
|
print("Drawing:", (w, h), (epd.height, epd.width))
|
|
print("Drawing:", (w, h), (epd.height, epd.width))
|
|
|
draw.text(center, text, align="center", font = font, fill = 0)
|
|
draw.text(center, text, align="center", font = font, fill = 0)
|