update
This commit is contained in:
+19
-2
@@ -6,7 +6,7 @@ import logging
|
|||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
import argparse
|
import argparse
|
||||||
from random import randint
|
from random import randint, choice
|
||||||
from PIL import Image,ImageDraw,ImageFont,ImageShow
|
from PIL import Image,ImageDraw,ImageFont,ImageShow
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='e-Ink Sheogorath')
|
parser = argparse.ArgumentParser(description='e-Ink Sheogorath')
|
||||||
@@ -71,13 +71,30 @@ try:
|
|||||||
#epd.displayPartBaseImage(epd.getbuffer(time_image))
|
#epd.displayPartBaseImage(epd.getbuffer(time_image))
|
||||||
|
|
||||||
epd.init(epd.PART_UPDATE)
|
epd.init(epd.PART_UPDATE)
|
||||||
|
lyrics = open("lyrics.txt", "r").readlines()
|
||||||
|
def get_lyric():
|
||||||
|
LENGTH = 15
|
||||||
|
lyric = choice(lyrics)
|
||||||
|
out_lyric = ""
|
||||||
|
counter = 0
|
||||||
|
for word in lyric.split(" "):
|
||||||
|
if counter + len(word) < LENGTH:
|
||||||
|
counter += len(word) + 1
|
||||||
|
out_lyric += word + " "
|
||||||
|
else:
|
||||||
|
counter = len(word) + 1
|
||||||
|
out_lyric += "\n" + word + " "
|
||||||
|
return out_lyric
|
||||||
|
|
||||||
while (True):
|
while (True):
|
||||||
|
lyric = get_lyric()
|
||||||
|
print(lyric)
|
||||||
time_image = Image.new('1', (epd.height, epd.width), 255)
|
time_image = Image.new('1', (epd.height, epd.width), 255)
|
||||||
time_draw = ImageDraw.Draw(time_image)
|
time_draw = ImageDraw.Draw(time_image)
|
||||||
time_image.paste(bmp, (2,2))
|
time_image.paste(bmp, (2,2))
|
||||||
time_draw.rectangle((160, 90, 250, 122), fill = 255)
|
time_draw.rectangle((160, 90, 250, 122), fill = 255)
|
||||||
time_draw.text((160, 90), time.strftime('%H:%M'), font = font24, fill = 0)
|
time_draw.text((160, 90), time.strftime('%H:%M'), font = font24, fill = 0)
|
||||||
time_draw.text((140, 10), 'Respect your \nparents, okay?', font = font15, fill = 0)
|
time_draw.text((140, 10), lyric, font = font15, fill = 0)
|
||||||
epd.displayPartial(epd.getbuffer(time_image))
|
epd.displayPartial(epd.getbuffer(time_image))
|
||||||
epd.displayPartial(epd.getbuffer(time_image))
|
epd.displayPartial(epd.getbuffer(time_image))
|
||||||
epd.displayPartial(epd.getbuffer(time_image))
|
epd.displayPartial(epd.getbuffer(time_image))
|
||||||
|
|||||||
Reference in New Issue
Block a user