def cycle_infinite(): try: epd = epd5in83.EPD() while True: rbtv_api = rbtv.RBTV() img = rbtv_api.get_layout("upcoming") draw(img, epd) time.sleep(5) img = rbtv_api.get_layout("upcoming-detail") draw(img, epd) time.sleep(5) img = rbtv_api.get_layout("blog") draw(img, epd) time.sleep(5) notifications = rbtv_api.get_notifications() size = len(notifications) i = 0 for n in notifications: i += 1 img = rbtv_api.get_layout("notification", n, i, size) draw(img, epd) time.sleep(2) except: print('traceback.format_exc():\n%s',traceback.format_exc()) exit()
def boot(): try: epd = epd5in83.EPD() rbtv_api = rbtv.RBTV() img = rbtv_api.get_layout("boot") draw(img, epd) time.sleep(2) except: print('traceback.format_exc():\n%s',traceback.format_exc()) exit()
#!/usr/bin/python # -*- coding:utf-8 -*- import epd5in83 import time from PIL import Image, ImageDraw, ImageFont import traceback try: epd = epd5in83.EPD() epd.init() print("Clear") epd.Clear(0xFF) print("Drawing") # Drawing on the Horizontal image Himage = Image.new('1', (epd5in83.EPD_WIDTH, epd5in83.EPD_HEIGHT), 255) # 255: clear the frame draw = ImageDraw.Draw(Himage) font24 = ImageFont.truetype( '/usr/share/fonts/truetype/wqy/wqy-microhei.ttc', 24) draw.text((10, 0), 'hello world', font=font24, fill=0) draw.text((10, 20), '5.83inch e-Paper', font=font24, fill=0) draw.text((150, 0), u'微雪电子', font=font24, fill=0) draw.line((20, 50, 70, 100), fill=0) draw.line((70, 50, 20, 100), fill=0) draw.rectangle((20, 50, 70, 100), outline=0) draw.line((165, 50, 165, 100), fill=0) draw.line((140, 75, 190, 75), fill=0) draw.arc((140, 50, 190, 100), 0, 360, fill=0) draw.rectangle((80, 50, 130, 100), fill=0)
def get_epd5in83(): return epd5in83.EPD()
from PIL import Image,ImageDraw,ImageFont import traceback import keypad import web font_dir = '/usr/share/fonts/truetype/nanum/' dir = '/home/pi/liveqr/' qr_code = qrcode.QRCode(version=2, error_correction=qrcode.constants.ERROR_CORRECT_L, box_size=5, border=0) try: panel = epd5in83.EPD() panel.init() panel.Clear() Image_Palette = Image.new('1', (epd5in83.EPD_WIDTH, epd5in83.EPD_HEIGHT), 255) font48 = ImageFont.truetype(font_dir + 'NanumGothic.ttf', 48) Image_Palette = Image.open(dir + 'background.bmp') Image_Palette = Image_Palette.convert('1') draw = ImageDraw.Draw(Image_Palette) draw.text((10,10), u'가격 입력', font=font48, fill=0) panel.display(panel.getbuffer(Image_Palette)) print("Plz Input Value") value = keypad.activation() out_text = '가격 : ' + str(value) + '원' url = web.call_api(int(value))