From a0089c56617a3a8651f7a67808068c8af6d821ba Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Tue, 28 Aug 2018 20:17:29 -0400 Subject: [PATCH] stuff --- good.py | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/good.py b/good.py index 862c2b1..19fbe38 100644 --- a/good.py +++ b/good.py @@ -1,8 +1,17 @@ import requests import json import os +import sys from selenium import webdriver import datetime +from PIL import ImageFont +import inkyphat + + +def main(): + fake_pages = {'2014': 7375, '2015': 23508, '2016': 17696, '2017': 19706, '2018': 9388} + #pages = print(get_goodreads_pages()) + draw(fake_pages) def get_goodreads_pages(): @@ -29,11 +38,28 @@ def get_goodreads_pages(): stats = driver.execute_script('return page_stats') return stats +def draw(pages): + colour = 'red' + inkyphat.set_colour(colour) + inkyphat.set_border(inkyphat.BLACK) + inkyphat.set_image("./background.png") + p2018 = str(pages['2018']) + + #font = ImageFont.truetype(inkyphat.fonts.AmaticSCBold, 38) + #w, h = font.getsize(p2018) + + ## Center the text and align it with the name strip + # + #x = (inkyphat.WIDTH / 2) - (w / 2) + #y = 71 - (h / 2) + # + #inkyphat.text((x, y), p2018, inkyphat.BLACK, font) + # + ## Partial update if using Inky pHAT display v1 + inkyphat.show() -def main(): - fake_pages = {'2014': 7375, '2015': 23508, '2016': 17696, '2017': 19706, '2018': 9388} - #print(get_goodreads_pages()) if __name__ == "__main__": main() +