From 454d77632fd6c76a6f2eabde3081441c31698f72 Mon Sep 17 00:00:00 2001 From: Robert Borzutzki Date: Tue, 18 Oct 2022 22:01:46 +0200 Subject: [PATCH] fix --- examples/epd.py | 2 + examples/epd_2in36g_test.py | 73 ------------------ examples/epd_2in66_test.py | 105 -------------------------- examples/epd_2in66b_test.py | 97 ------------------------ examples/epd_3in0g_test.py | 99 ------------------------- examples/epd_3in52_test.py | 119 ------------------------------ examples/epd_3in7_test.py | 115 ----------------------------- examples/epd_4in01f_test.py | 106 -------------------------- examples/epd_4in2_test.py | 131 --------------------------------- examples/epd_4in2b_V2_test.py | 101 ------------------------- examples/epd_4in2bc_test.py | 101 ------------------------- examples/epd_4in37g_test.py | 76 ------------------- examples/epd_5in65f_test.py | 93 ----------------------- examples/epd_5in83_V2_test.py | 89 ---------------------- examples/epd_5in83_test.py | 90 ---------------------- examples/epd_5in83b_V2_test.py | 99 ------------------------- examples/epd_5in83bc_test.py | 99 ------------------------- examples/epd_7in3g_test.py | 76 ------------------- examples/epd_7in5_HD_test.py | 90 ---------------------- examples/epd_7in5_V2_test.py | 90 ---------------------- examples/epd_7in5_test.py | 90 ---------------------- examples/epd_7in5b_HD_test.py | 98 ------------------------ examples/epd_7in5b_V2_test.py | 97 ------------------------ examples/epd_7in5bc_test.py | 102 ------------------------- 24 files changed, 2 insertions(+), 2236 deletions(-) delete mode 100644 examples/epd_2in36g_test.py delete mode 100644 examples/epd_2in66_test.py delete mode 100644 examples/epd_2in66b_test.py delete mode 100644 examples/epd_3in0g_test.py delete mode 100644 examples/epd_3in52_test.py delete mode 100644 examples/epd_3in7_test.py delete mode 100644 examples/epd_4in01f_test.py delete mode 100644 examples/epd_4in2_test.py delete mode 100644 examples/epd_4in2b_V2_test.py delete mode 100644 examples/epd_4in2bc_test.py delete mode 100644 examples/epd_4in37g_test.py delete mode 100644 examples/epd_5in65f_test.py delete mode 100644 examples/epd_5in83_V2_test.py delete mode 100644 examples/epd_5in83_test.py delete mode 100644 examples/epd_5in83b_V2_test.py delete mode 100644 examples/epd_5in83bc_test.py delete mode 100644 examples/epd_7in3g_test.py delete mode 100644 examples/epd_7in5_HD_test.py delete mode 100644 examples/epd_7in5_V2_test.py delete mode 100644 examples/epd_7in5_test.py delete mode 100644 examples/epd_7in5b_HD_test.py delete mode 100644 examples/epd_7in5b_V2_test.py delete mode 100644 examples/epd_7in5bc_test.py diff --git a/examples/epd.py b/examples/epd.py index cd1369f..cdf3845 100644 --- a/examples/epd.py +++ b/examples/epd.py @@ -29,6 +29,8 @@ try: font20 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 20) font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) + HBlackimage = Image.new('1', (epd.height, epd.width), 255) # 298*126 + drawblack = ImageDraw.Draw(HBlackimage) drawblack.text((10, 0), 'hello world', font = font20, fill = 0) drawblack.text((10, 0), 'hier bin ich', font = font20, fill = 0) diff --git a/examples/epd_2in36g_test.py b/examples/epd_2in36g_test.py deleted file mode 100644 index ba25138..0000000 --- a/examples/epd_2in36g_test.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/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 epd2in36g -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd2in36g Demo") - - epd = epd2in36g.EPD() - logging.info("init and Clear") - epd.init() - epd.Clear() - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - font40 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 40) - - # Drawing on the image - logging.info("1.Drawing on the image...") - Himage = Image.new('RGB', (epd.width, epd.height), epd.WHITE) - draw = ImageDraw.Draw(Himage) - draw.text((5, 0), 'hello world', font = font18, fill = epd.RED) - draw.text((5, 20), '2.36inch e-Paper', font = font18, fill = epd.YELLOW) - draw.text((5, 40), u'微雪电子', font = font40, fill = epd.BLACK) - draw.text((5, 85), u'微雪电子', font = font40, fill = epd.YELLOW) - draw.text((5, 125), u'微雪电子', font = font40, fill = epd.RED) - - draw.line((5, 175, 45, 245), fill = epd.RED) - draw.line((45, 175, 5, 245), fill = epd.YELLOW) - draw.rectangle((5, 175, 45, 245), outline = epd.BLACK) - draw.rectangle((55, 175, 95, 245), fill = epd.BLACK) - draw.arc((115, 175, 150, 210), 0, 360, fill = epd.BLACK) - draw.chord((115, 215, 150, 250), 0, 360, fill = epd.BLACK) - draw.chord((10, 252, 50, 295), 0, 360, fill = epd.YELLOW) - draw.chord((110, 252, 150, 295), 0, 360, fill = epd.RED) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - # read bmp file - logging.info("2.read bmp file") - Himage = Image.open(os.path.join(picdir, '2.36inch-1.bmp')) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - logging.info("3.read bmp file") - Himage = Image.open(os.path.join(picdir, '2.36inch-2.bmp')) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - logging.info("Clear...") - epd.Clear() - - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd2in36g.epdconfig.module_exit() - exit() diff --git a/examples/epd_2in66_test.py b/examples/epd_2in66_test.py deleted file mode 100644 index 982cb64..0000000 --- a/examples/epd_2in66_test.py +++ /dev/null @@ -1,105 +0,0 @@ -#!/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 epd2in66 -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd2in66 Demo") - - epd = epd2in66.EPD() - logging.info("init and Clear") - epd.init(0) - epd.Clear() - - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - - # Drawing on the Horizontal image - logging.info("1.Drawing on the Horizontal image...") - Himage = Image.new('1', (epd.height, epd.width), 0xFF) # 0xFF: clear the frame - draw = ImageDraw.Draw(Himage) - draw.text((10, 0), 'hello world', font = font24, fill = 0) - draw.text((10, 20), '2.66inch e-Paper', font = font24, fill = 0) - draw.text((10, 100), 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) - draw.chord((200, 50, 250, 100), 0, 360, fill = 0) - epd.display(epd.getbuffer(Himage)) - time.sleep(5) - - logging.info("2.read bmp file") - Himage = Image.open(os.path.join(picdir, '2.66inch-9.bmp')) - epd.display(epd.getbuffer(Himage)) - time.sleep(5) - - logging.info("3.read bmp file on window") - Himage2 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - bmp = Image.open(os.path.join(picdir, '100x100.bmp')) - Himage2.paste(bmp, (50,20)) - epd.display(epd.getbuffer(Himage2)) - time.sleep(5) - - # Drawing on the Vertical image - logging.info("4.Drawing on the Vertical image...") - Limage = Image.new('1', (epd.width, epd.height), 0xFF) # 0xFF: clear the frame - draw = ImageDraw.Draw(Limage) - draw.text((2, 0), 'hello world', font = font18, fill = 0) - draw.text((2, 20), '2.66inch epd', font = font18, fill = 0) - draw.text((10, 40), u'微雪电子', font = font24, fill = 0) - draw.line((10, 90, 60, 140), fill = 0) - draw.line((60, 90, 10, 140), fill = 0) - draw.rectangle((10, 90, 60, 140), outline = 0) - draw.line((95, 90, 95, 140), fill = 0) - draw.line((70, 115, 120, 115), fill = 0) - draw.arc((70, 90, 120, 140), 0, 360, fill = 0) - draw.rectangle((10, 150, 60, 200), fill = 0) - draw.chord((70, 150, 120, 200), 0, 360, fill = 0) - epd.display(epd.getbuffer(Limage)) - time.sleep(5) - - # partial update, mode 1 - logging.info("5.show time, partial update, just mode 1") - epd.init(1) # partial mode - epd.Clear() - time_draw = ImageDraw.Draw(Limage) - num = 0 - while (True): - time_draw.rectangle((10, 210, 120, 250), fill = 255) - time_draw.text((10, 210), time.strftime('%H:%M:%S'), font = font24, fill = 0) - epd.display(epd.getbuffer(Limage)) - - num = num + 1 - if(num == 10): - break - - logging.info("Clear...") - epd.init(0) - epd.Clear() - - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd2in66.epdconfig.module_exit() - exit() diff --git a/examples/epd_2in66b_test.py b/examples/epd_2in66b_test.py deleted file mode 100644 index 88cc2a8..0000000 --- a/examples/epd_2in66b_test.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/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 epd2in66b -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd2in66 b Demo") - - epd = epd2in66b.EPD() - logging.info("init and Clear") - epd.init() - epd.Clear() - - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - - # Drawing on the Horizontal image - logging.info("1.Drawing on the Horizontal image...") - HBlackimage = Image.new('1', (epd.height, epd.width), 255) # 296*152 - HRYimage = Image.new('1', (epd.height, epd.width), 255) # 296*152 ryimage: red or yellow image - drawblack = ImageDraw.Draw(HBlackimage) - drawry = ImageDraw.Draw(HRYimage) - drawblack.text((10, 0), 'hello world', font = font24, fill = 0) - drawblack.text((10, 20), '2.66inch e-Paper b', font = font24, fill = 0) - drawblack.text((150, 0), u'微雪电子', font = font24, fill = 0) - drawblack.line((20, 50, 70, 100), fill = 0) - drawblack.line((70, 50, 20, 100), fill = 0) - drawblack.rectangle((20, 50, 70, 100), outline = 0) - drawry.line((165, 50, 165, 100), fill = 0) - drawry.line((140, 75, 190, 75), fill = 0) - drawry.arc((140, 50, 190, 100), 0, 360, fill = 0) - drawry.rectangle((80, 50, 130, 100), fill = 0) - drawry.chord((200, 50, 250, 100), 0, 360, fill = 0) - epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage)) - time.sleep(3) - - logging.info("2.read bmp file") - HBlackimage = Image.open(os.path.join(picdir, '2in66b_b.bmp')) - HRYimage = Image.open(os.path.join(picdir, '2in66b_r.bmp')) - epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage)) - time.sleep(3) - - logging.info("3.read bmp file on window") - blackimage1 = Image.new('1', (epd.height, epd.width), 255) - redimage1 = Image.new('1', (epd.height, epd.width), 255) - newimage = Image.open(os.path.join(picdir, '100x100.bmp')) - blackimage1.paste(newimage, (50,10)) - epd.display(epd.getbuffer(blackimage1), epd.getbuffer(redimage1)) - time.sleep(3) - - # Drawing on the Vertical image - logging.info("4.Drawing on the Vertical image...") - LBlackimage = Image.new('1', (epd.width, epd.height), 255) # 152*296 - LRYimage = Image.new('1', (epd.width, epd.height), 255) # 152*296 - drawblack = ImageDraw.Draw(LBlackimage) - drawry = ImageDraw.Draw(LRYimage) - time.sleep(3) - - drawblack.text((2, 0), 'hello world', font = font18, fill = 0) - drawblack.text((2, 20), '2.9inch epd bc', font = font18, fill = 0) - drawblack.text((20, 50), u'微雪电子', font = font18, fill = 0) - drawblack.line((10, 90, 60, 140), fill = 0) - drawblack.line((60, 90, 10, 140), fill = 0) - drawblack.rectangle((10, 90, 60, 140), outline = 0) - drawry.line((95, 90, 95, 140), fill = 0) - drawry.line((70, 115, 120, 115), fill = 0) - drawry.arc((70, 90, 120, 140), 0, 360, fill = 0) - drawry.rectangle((10, 150, 60, 200), fill = 0) - drawry.chord((70, 150, 120, 200), 0, 360, fill = 0) - epd.display(epd.getbuffer(LBlackimage), epd.getbuffer(LRYimage)) - time.sleep(3) - - logging.info("Clear...") - epd.Clear() - - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd2in66b.epdconfig.module_exit() - exit() diff --git a/examples/epd_3in0g_test.py b/examples/epd_3in0g_test.py deleted file mode 100644 index a7184e2..0000000 --- a/examples/epd_3in0g_test.py +++ /dev/null @@ -1,99 +0,0 @@ -#!/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 epd3in0g -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd3in0g Demo") - - epd = epd3in0g.EPD() - logging.info("init and Clear") - epd.init() - epd.Clear() - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - font40 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 40) - - # Drawing on the image - epd.init() - logging.info("1.Drawing on the image...") - Himage = Image.new('RGB', (epd.width, epd.height), 0xffffff) - draw = ImageDraw.Draw(Himage) - draw.text((5, 0), 'hello world', font = font18, fill = epd.RED) - draw.text((5, 20), '3inch e-Paper', font = font24, fill = epd.YELLOW) - draw.text((5, 45), u'微雪电子', font = font40, fill = epd.BLACK) - draw.text((5, 85), u'微雪电子', font = font40, fill = epd.YELLOW) - draw.text((5, 125), u'微雪电子', font = font40, fill = epd.RED) - draw.line((5, 170, 80, 245), fill = epd.RED) - draw.line((80, 170, 5, 245), fill = epd.YELLOW) - draw.rectangle((5, 170, 80, 245), outline = epd.BLACK) - draw.rectangle((90, 170, 165, 245), fill = epd.YELLOW) - draw.arc((5, 250, 80, 325), 0, 360, fill = epd.BLACK) - draw.chord((90, 250, 165, 325), 0, 360, fill = epd.RED) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - # Switch width and height for landscape display - epd.init() - logging.info("2.Drawing on the image...") - Himage = Image.new('RGB', (epd.height, epd.width), epd.WHITE) - draw = ImageDraw.Draw(Himage) - draw.text((5, 0), 'hello world', font = font18, fill = epd.RED) - draw.text((5, 20), '3inch e-Paper', font = font24, fill = epd.YELLOW) - draw.text((5, 45), u'微雪电子', font = font40, fill = epd.BLACK) - draw.text((5, 85), u'微雪电子', font = font40, fill = epd.YELLOW) - draw.text((5, 125), u'微雪电子', font = font40, fill = epd.RED) - draw.line((205, 5, 295, 65), fill = epd.RED) - draw.line((295, 5, 205, 65), fill = epd.YELLOW) - draw.rectangle((205, 5, 295, 65), outline = epd.BLACK) - draw.rectangle((305, 5, 395, 65), fill = epd.RED) - draw.arc((205, 75, 295, 165), 0, 360, fill = epd.BLACK) - draw.chord((305, 75, 395, 165), 0, 360, fill = epd.YELLOW) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - # read bmp file - epd.init() - logging.info("3.read bmp file") - Himage = Image.open(os.path.join(picdir, '3inch-1.bmp')) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - epd.init() - logging.info("4.read bmp file") - Himage = Image.open(os.path.join(picdir, '3inch-2.bmp')) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - epd.init() - logging.info("5.read bmp file") - Himage = Image.open(os.path.join(picdir, '3inch-3.bmp')) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - epd.init() - logging.info("Clear...") - epd.Clear() - - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd3in0g.epdconfig.module_exit() - exit() diff --git a/examples/epd_3in52_test.py b/examples/epd_3in52_test.py deleted file mode 100644 index 22c8185..0000000 --- a/examples/epd_3in52_test.py +++ /dev/null @@ -1,119 +0,0 @@ -#!/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 epd3in52 -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd3in52 Demo") - - epd = epd3in52.EPD() - logging.info("init and Clear") - epd.init() - epd.display_NUM(epd.WHITE) - epd.lut_GC() - epd.refresh() - - epd.send_command(0x50) - epd.send_data(0x17) - time.sleep(2) - - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - font30 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 40) - - # Drawing on the Horizontal image - logging.info("1.Drawing on the Horizontal image...") - Himage = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - draw = ImageDraw.Draw(Himage) - draw.text((10, 0), 'hello world', font = font24, fill = 0) - draw.text((10, 20), '3.52inch 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) - draw.chord((200, 50, 250, 100), 0, 360, fill = 0) - epd.display(epd.getbuffer(Himage)) - epd.lut_GC() - epd.refresh() - time.sleep(2) - - # Drawing on the Vertical image - logging.info("2.Drawing on the Vertical image...") - Limage = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame - draw = ImageDraw.Draw(Limage) - draw.text((2, 0), 'hello world', font = font18, fill = 0) - draw.text((2, 20), '3.52inch e-Paper', font = font18, fill = 0) - draw.text((20, 50), u'微雪电子', font = font18, fill = 0) - draw.line((10, 90, 60, 140), fill = 0) - draw.line((60, 90, 10, 140), fill = 0) - draw.rectangle((10, 90, 60, 140), outline = 0) - draw.line((95, 90, 95, 140), fill = 0) - draw.line((70, 115, 120, 115), fill = 0) - draw.arc((70, 90, 120, 140), 0, 360, fill = 0) - draw.rectangle((10, 150, 60, 200), fill = 0) - draw.chord((70, 150, 120, 200), 0, 360, fill = 0) - epd.display(epd.getbuffer(Limage)) - epd.lut_GC() - epd.refresh() - time.sleep(2) - - logging.info("3.read bmp file") - Himage = Image.open(os.path.join(picdir, '3in52-1.bmp')) - epd.display(epd.getbuffer(Himage)) - epd.lut_GC() - epd.refresh() - time.sleep(2) - - logging.info("4.read bmp file on window") - Himage2 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - bmp = Image.open(os.path.join(picdir, '100x100.bmp')) - Himage2.paste(bmp, (50,10)) - epd.display(epd.getbuffer(Himage2)) - epd.lut_GC() - epd.refresh() - time.sleep(2) - - - # print("Quick refresh is supported, but the refresh effect is not good, but it is not recommended") - # Himage = Image.open(os.path.join(picdir, '3in52-2.bmp')) - # epd.display(epd.getbuffer(Himage)) - # epd.lut_DU() - # epd.refresh() - # time.sleep(2) - - # Himage = Image.open(os.path.join(picdir, '3in52-3.bmp')) - # epd.display(epd.getbuffer(Himage)) - # epd.lut_DU() - # epd.refresh() - # time.sleep(2) - - - logging.info("Clear...") - epd.Clear() - - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd3in52.epdconfig.module_exit() - exit() diff --git a/examples/epd_3in7_test.py b/examples/epd_3in7_test.py deleted file mode 100644 index 2920c2e..0000000 --- a/examples/epd_3in7_test.py +++ /dev/null @@ -1,115 +0,0 @@ -#!/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 epd3in7 -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd3in7 Demo") - - epd = epd3in7.EPD() - logging.info("init and Clear") - epd.init(0) - epd.Clear(0xFF, 0) - - font36 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 36) - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - - # Drawing on the Horizontal image - logging.info("1.Drawing on the Horizontal image...") - Himage = Image.new('L', (epd.height, epd.width), 0xFF) # 0xFF: clear the frame - draw = ImageDraw.Draw(Himage) - draw.text((10, 0), 'hello world', font = font24, fill = 0) - draw.text((10, 20), '3.7inch e-Paper', font = font24, fill = 0) - draw.rectangle((10, 110, 154, 146), 'black', 'black') - draw.text((10, 110), u'微雪电子', font = font36, fill = epd.GRAY1) - draw.text((10, 150), u'微雪电子', font = font36, fill = epd.GRAY2) - draw.text((10, 190), u'微雪电子', font = font36, fill = epd.GRAY3) - draw.text((10, 230), u'微雪电子', font = font36, fill = epd.GRAY4) - 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) - draw.chord((200, 50, 250, 100), 0, 360, fill = 0) - epd.display_4Gray(epd.getbuffer_4Gray(Himage)) - time.sleep(5) - - logging.info("2.read 4 Gray bmp file") - Himage = Image.open(os.path.join(picdir, '3in7_4gray2.bmp')) - epd.display_4Gray(epd.getbuffer_4Gray(Himage)) - time.sleep(5) - - logging.info("3.read bmp file on window") - Himage2 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - bmp = Image.open(os.path.join(picdir, '100x100.bmp')) - Himage2.paste(bmp, (200,50)) - epd.display_4Gray(epd.getbuffer_4Gray(Himage2)) - time.sleep(5) - - # Drawing on the Vertical image - logging.info("4.Drawing on the Vertical image...") - Limage = Image.new('L', (epd.width, epd.height), 0xFF) # 0xFF: clear the frame - draw = ImageDraw.Draw(Limage) - draw.text((2, 0), 'hello world', font = font18, fill = 0) - draw.text((2, 20), '3.7inch epd', font = font18, fill = 0) - draw.rectangle((130, 20, 274, 56), 'black', 'black') - draw.text((130, 20), u'微雪电子', font = font36, fill = epd.GRAY1) - draw.text((130, 60), u'微雪电子', font = font36, fill = epd.GRAY2) - draw.text((130, 100), u'微雪电子', font = font36, fill = epd.GRAY3) - draw.text((130, 140), u'微雪电子', font = font36, fill = epd.GRAY4) - draw.line((10, 90, 60, 140), fill = 0) - draw.line((60, 90, 10, 140), fill = 0) - draw.rectangle((10, 90, 60, 140), outline = 0) - draw.line((95, 90, 95, 140), fill = 0) - draw.line((70, 115, 120, 115), fill = 0) - draw.arc((70, 90, 120, 140), 0, 360, fill = 0) - draw.rectangle((10, 150, 60, 200), fill = 0) - draw.chord((70, 150, 120, 200), 0, 360, fill = 0) - epd.display_4Gray(epd.getbuffer_4Gray(Limage)) - time.sleep(5) - - # partial update, just 1 Gary mode - logging.info("5.show time, partial update, just 1 Gary mode") - epd.init(1) # 1 Gary mode - epd.Clear(0xFF, 1) - time_image = Image.new('1', (epd.height, epd.width), 255) - time_draw = ImageDraw.Draw(time_image) - num = 0 - while (True): - time_draw.rectangle((10, 10, 120, 50), fill = 255) - time_draw.text((10, 10), time.strftime('%H:%M:%S'), font = font24, fill = 0) - epd.display_1Gray(epd.getbuffer(time_image)) - - num = num + 1 - if(num == 20): - break - - logging.info("Clear...") - epd.init(0) - epd.Clear(0xFF, 0) - - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd3in7.epdconfig.module_exit() - exit() diff --git a/examples/epd_4in01f_test.py b/examples/epd_4in01f_test.py deleted file mode 100644 index 075f179..0000000 --- a/examples/epd_4in01f_test.py +++ /dev/null @@ -1,106 +0,0 @@ -#!/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 epd4in01f -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd4in01f Demo") - epd = epd4in01f.EPD() - - logging.info("init and Clear") - epd.init() - epd.Clear() - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - font30 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 40) - - # Drawing on the Horizontal image - logging.info("1.Drawing on the Horizontal image...") - Himage = Image.new('RGB', (epd.width, epd.height), 0xffffff) # 255: clear the frame - draw = ImageDraw.Draw(Himage) - draw.text((10, 0), 'hello world', font = font24, fill = 0) - draw.text((10, 20), '4.01inch e-Paper', font = font24, fill = 0) - draw.text((10, 160), u'微雪电子', font = font30, fill = epd.BLACK) - draw.text((10, 200), u'微雪电子', font = font30, fill = epd.ORANGE) - draw.text((10, 240), u'微雪电子', font = font30, fill = epd.GREEN) - draw.text((10, 280), u'微雪电子', font = font30, fill = epd.BLUE) - draw.text((10, 320), u'微雪电子', font = font30, fill = epd.RED) - draw.text((10, 360), u'微雪电子', font = font30, fill = epd.YELLOW) - 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) - draw.chord((200, 50, 250, 100), 0, 360, fill = 0) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - epd.Clear() - logging.info("2.Drawing on the Vertical image...") - Himage = Image.new('RGB', (epd.height, epd.width), 0xffffff) # 255: clear the frame - draw = ImageDraw.Draw(Himage) - draw.text((10, 0), 'hello world', font = font24, fill = 0) - draw.text((10, 20), '4.01inch e-Paper', font = font24, fill = 0) - draw.text((10, 160), u'微雪电子', font = font30, fill = epd.BLACK) - draw.text((10, 200), u'微雪电子', font = font30, fill = epd.ORANGE) - draw.text((10, 240), u'微雪电子', font = font30, fill = epd.GREEN) - draw.text((10, 280), u'微雪电子', font = font30, fill = epd.BLUE) - draw.text((10, 320), u'微雪电子', font = font30, fill = epd.RED) - draw.text((10, 360), u'微雪电子', font = font30, fill = epd.YELLOW) - 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) - draw.chord((200, 50, 250, 100), 0, 360, fill = 0) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - epd.Clear() - logging.info("3.read bmp file") - Himage = Image.open(os.path.join(picdir, '4in01-1.bmp')) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - epd.Clear() - Himage = Image.open(os.path.join(picdir, '4in01-2.bmp')) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - epd.Clear() - Himage = Image.open(os.path.join(picdir, '4in01-3.bmp')) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - epd.Clear() - Himage = Image.open(os.path.join(picdir, '4in01-4.bmp')) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - epd.Clear() - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd4in01f.epdconfig.module_exit() - exit() diff --git a/examples/epd_4in2_test.py b/examples/epd_4in2_test.py deleted file mode 100644 index 0e70de9..0000000 --- a/examples/epd_4in2_test.py +++ /dev/null @@ -1,131 +0,0 @@ -#!/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 epd4in2 -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd4in2 Demo") - - epd = epd4in2.EPD() - logging.info("init and Clear") - epd.init() - epd.Clear() - - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - font35 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 35) - - # Drawing on the Horizontal image - logging.info("1.Drawing on the Horizontal image...") - Himage = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame - draw = ImageDraw.Draw(Himage) - draw.text((10, 0), 'hello world', font = font24, fill = 0) - draw.text((10, 20), '4.2inch 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) - draw.chord((200, 50, 250, 100), 0, 360, fill = 0) - epd.display(epd.getbuffer(Himage)) - time.sleep(2) - - # Drawing on the Vertical image - logging.info("2.Drawing on the Vertical image...") - Limage = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - draw = ImageDraw.Draw(Limage) - draw.text((2, 0), 'hello world', font = font18, fill = 0) - draw.text((2, 20), '4.2inch epd', font = font18, fill = 0) - draw.text((20, 50), u'微雪电子', font = font18, fill = 0) - draw.line((10, 90, 60, 140), fill = 0) - draw.line((60, 90, 10, 140), fill = 0) - draw.rectangle((10, 90, 60, 140), outline = 0) - draw.line((95, 90, 95, 140), fill = 0) - draw.line((70, 115, 120, 115), fill = 0) - draw.arc((70, 90, 120, 140), 0, 360, fill = 0) - draw.rectangle((10, 150, 60, 200), fill = 0) - draw.chord((70, 150, 120, 200), 0, 360, fill = 0) - epd.display(epd.getbuffer(Limage)) - time.sleep(2) - - logging.info("3.read bmp file") - Himage = Image.open(os.path.join(picdir, '4in2.bmp')) - epd.display(epd.getbuffer(Himage)) - time.sleep(2) - - logging.info("4.read bmp file on window") - Himage2 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - bmp = Image.open(os.path.join(picdir, '100x100.bmp')) - Himage2.paste(bmp, (50,10)) - epd.display(epd.getbuffer(Himage2)) - time.sleep(2) - - logging.info("Clear...") - epd.Clear() - - if(0): - print("Support for partial refresh, but the refresh effect is not good, but it is not recommended") - print("Local refresh is off by default and is not recommended.") - Himage3 = Image.new('1', (epd.width, epd.height), 0) # 255: clear the frame - draw = ImageDraw.Draw(Himage3) - epd.init_Partial() - for j in range(0, int(20)): - draw.rectangle((8, 80, 48, 155), fill = 255) - draw.text((8, 80), str(j) , font = font35, fill = 0) - draw.text((8, 120), str(20-j) , font = font35, fill = 0) - epd.EPD_4IN2_PartialDisplay(8, 80, 42, 155, epd.getbuffer(Himage3)) - time.sleep(2); - - - '''4Gray display''' - logging.info("5.4Gray display--------------------------------") - epd.Init_4Gray() - - Limage = Image.new('L', (epd.width, epd.height), 0) # 255: clear the frame - draw = ImageDraw.Draw(Limage) - draw.text((20, 0), u'微雪电子', font = font35, fill = epd.GRAY1) - draw.text((20, 35), u'微雪电子', font = font35, fill = epd.GRAY2) - draw.text((20, 70), u'微雪电子', font = font35, fill = epd.GRAY3) - draw.text((40, 110), 'hello world', font = font18, fill = epd.GRAY1) - draw.line((10, 140, 60, 190), fill = epd.GRAY1) - draw.line((60, 140, 10, 190), fill = epd.GRAY1) - draw.rectangle((10, 140, 60, 190), outline = epd.GRAY1) - draw.line((95, 140, 95, 190), fill = epd.GRAY1) - draw.line((70, 165, 120, 165), fill = epd.GRAY1) - draw.arc((70, 140, 120, 190), 0, 360, fill = epd.GRAY1) - draw.rectangle((10, 200, 60, 250), fill = epd.GRAY1) - draw.chord((70, 200, 120, 250), 0, 360, fill = epd.GRAY1) - epd.display_4Gray(epd.getbuffer_4Gray(Limage)) - time.sleep(3) - - #display 4Gra bmp - Himage = Image.open(os.path.join(picdir, '4in2_Scale_1.bmp')) - epd.display_4Gray(epd.getbuffer_4Gray(Himage)) - time.sleep(4) - - epd.Clear() - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd4in2.epdconfig.module_exit() - exit() diff --git a/examples/epd_4in2b_V2_test.py b/examples/epd_4in2b_V2_test.py deleted file mode 100644 index 5b0b619..0000000 --- a/examples/epd_4in2b_V2_test.py +++ /dev/null @@ -1,101 +0,0 @@ -#!/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 epd4in2b_V2 -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd4in2b_V2 Demo") - - epd = epd4in2b_V2.EPD() - logging.info("init and Clear") - epd.init() - epd.Clear() - time.sleep(1) - - # Drawing on the image - logging.info("Drawing") - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - - # Drawing on the Horizontal image - logging.info("1.Drawing on the Horizontal image...") - HBlackimage = Image.new('1', (epd.width, epd.height), 255) # 298*126 - HRYimage = Image.new('1', (epd.width, epd.height), 255) # 298*126 ryimage: red or yellow image - drawblack = ImageDraw.Draw(HBlackimage) - drawry = ImageDraw.Draw(HRYimage) - drawblack.text((10, 0), 'hello world', font = font24, fill = 0) - drawblack.text((10, 20), '4.2inch e-Paper bc', font = font24, fill = 0) - drawblack.text((150, 0), u'微雪电子', font = font24, fill = 0) - drawblack.line((20, 50, 70, 100), fill = 0) - drawblack.line((70, 50, 20, 100), fill = 0) - drawblack.rectangle((20, 50, 70, 100), outline = 0) - drawry.line((165, 50, 165, 100), fill = 0) - drawry.line((140, 75, 190, 75), fill = 0) - drawry.arc((140, 50, 190, 100), 0, 360, fill = 0) - drawry.rectangle((80, 50, 130, 100), fill = 0) - drawry.chord((200, 50, 250, 100), 0, 360, fill = 0) - epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage)) - time.sleep(2) - - # Drawing on the Vertical image - logging.info("2.Drawing on the Vertical image...") - LBlackimage = Image.new('1', (epd.height, epd.width), 255) # 126*298 - LRYimage = Image.new('1', (epd.height, epd.width), 255) # 126*298 - drawblack = ImageDraw.Draw(LBlackimage) - drawry = ImageDraw.Draw(LRYimage) - - drawblack.text((2, 0), 'hello world', font = font18, fill = 0) - drawblack.text((2, 20), '4.2inch epd bc', font = font18, fill = 0) - drawblack.text((20, 50), u'微雪电子', font = font18, fill = 0) - drawblack.line((10, 90, 60, 140), fill = 0) - drawblack.line((60, 90, 10, 140), fill = 0) - drawblack.rectangle((10, 90, 60, 140), outline = 0) - drawry.line((95, 90, 95, 140), fill = 0) - drawry.line((70, 115, 120, 115), fill = 0) - drawry.arc((70, 90, 120, 140), 0, 360, fill = 0) - drawry.rectangle((10, 150, 60, 200), fill = 0) - drawry.chord((70, 150, 120, 200), 0, 360, fill = 0) - epd.display(epd.getbuffer(LBlackimage), epd.getbuffer(LRYimage)) - time.sleep(2) - - logging.info("3.read bmp file") - HBlackimage = Image.open(os.path.join(picdir, '4in2b-b.bmp')) - HRYimage = Image.open(os.path.join(picdir, '4in2b-r.bmp')) - # HBlackimage = Image.open(os.path.join(picdir, '4in2c-b.bmp')) - # HRYimage = Image.open(os.path.join(picdir, '4in2c-y.bmp')) - epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage)) - time.sleep(2) - - logging.info("4.read bmp file on window") - blackimage1 = Image.new('1', (epd.width, epd.height), 255) # 298*126 - redimage1 = Image.new('1', (epd.width, epd.height), 255) # 298*126 - newimage = Image.open(os.path.join(picdir, '100x100.bmp')) - blackimage1.paste(newimage, (50,10)) - epd.display(epd.getbuffer(blackimage1), epd.getbuffer(redimage1)) - - logging.info("Clear...") - epd.init() - epd.Clear() - - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd4in2b_V2.epdconfig.module_exit() - exit() diff --git a/examples/epd_4in2bc_test.py b/examples/epd_4in2bc_test.py deleted file mode 100644 index 2e45ba3..0000000 --- a/examples/epd_4in2bc_test.py +++ /dev/null @@ -1,101 +0,0 @@ -#!/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 epd4in2bc -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd4in2bc Demo") - - epd = epd4in2bc.EPD() - logging.info("init and Clear") - epd.init() - epd.Clear() - time.sleep(1) - - # Drawing on the image - logging.info("Drawing") - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - - # Drawing on the Horizontal image - logging.info("1.Drawing on the Horizontal image...") - HBlackimage = Image.new('1', (epd.width, epd.height), 255) # 298*126 - HRYimage = Image.new('1', (epd.width, epd.height), 255) # 298*126 ryimage: red or yellow image - drawblack = ImageDraw.Draw(HBlackimage) - drawry = ImageDraw.Draw(HRYimage) - drawblack.text((10, 0), 'hello world', font = font24, fill = 0) - drawblack.text((10, 20), '4.2inch e-Paper bc', font = font24, fill = 0) - drawblack.text((150, 0), u'微雪电子', font = font24, fill = 0) - drawblack.line((20, 50, 70, 100), fill = 0) - drawblack.line((70, 50, 20, 100), fill = 0) - drawblack.rectangle((20, 50, 70, 100), outline = 0) - drawry.line((165, 50, 165, 100), fill = 0) - drawry.line((140, 75, 190, 75), fill = 0) - drawry.arc((140, 50, 190, 100), 0, 360, fill = 0) - drawry.rectangle((80, 50, 130, 100), fill = 0) - drawry.chord((200, 50, 250, 100), 0, 360, fill = 0) - epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage)) - time.sleep(2) - - # Drawing on the Vertical image - logging.info("2.Drawing on the Vertical image...") - LBlackimage = Image.new('1', (epd.height, epd.width), 255) # 126*298 - LRYimage = Image.new('1', (epd.height, epd.width), 255) # 126*298 - drawblack = ImageDraw.Draw(LBlackimage) - drawry = ImageDraw.Draw(LRYimage) - - drawblack.text((2, 0), 'hello world', font = font18, fill = 0) - drawblack.text((2, 20), '4.2inch epd bc', font = font18, fill = 0) - drawblack.text((20, 50), u'微雪电子', font = font18, fill = 0) - drawblack.line((10, 90, 60, 140), fill = 0) - drawblack.line((60, 90, 10, 140), fill = 0) - drawblack.rectangle((10, 90, 60, 140), outline = 0) - drawry.line((95, 90, 95, 140), fill = 0) - drawry.line((70, 115, 120, 115), fill = 0) - drawry.arc((70, 90, 120, 140), 0, 360, fill = 0) - drawry.rectangle((10, 150, 60, 200), fill = 0) - drawry.chord((70, 150, 120, 200), 0, 360, fill = 0) - epd.display(epd.getbuffer(LBlackimage), epd.getbuffer(LRYimage)) - time.sleep(2) - - logging.info("3.read bmp file") - HBlackimage = Image.open(os.path.join(picdir, '4in2b-b.bmp')) - HRYimage = Image.open(os.path.join(picdir, '4in2b-r.bmp')) - # HBlackimage = Image.open(os.path.join(picdir, '4in2c-b.bmp')) - # HRYimage = Image.open(os.path.join(picdir, '4in2c-y.bmp')) - epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage)) - time.sleep(2) - - logging.info("4.read bmp file on window") - blackimage1 = Image.new('1', (epd.width, epd.height), 255) # 298*126 - redimage1 = Image.new('1', (epd.width, epd.height), 255) # 298*126 - newimage = Image.open(os.path.join(picdir, '100x100.bmp')) - blackimage1.paste(newimage, (50,10)) - epd.display(epd.getbuffer(blackimage1), epd.getbuffer(redimage1)) - - logging.info("Clear...") - epd.init() - epd.Clear() - - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd4in2bc.epdconfig.module_exit() - exit() diff --git a/examples/epd_4in37g_test.py b/examples/epd_4in37g_test.py deleted file mode 100644 index 61b3fd8..0000000 --- a/examples/epd_4in37g_test.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/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 epd4in37g -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd4in37g Demo") - - epd = epd4in37g.EPD() - logging.info("init and Clear") - epd.init() - epd.Clear() - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - font40 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 40) - - # Drawing on the image - logging.info("1.Drawing on the image...") - Himage = Image.new('RGB', (epd.width, epd.height), epd.WHITE) # 255: clear the frame - draw = ImageDraw.Draw(Himage) - draw.text((5, 0), 'hello world', font = font18, fill = epd.RED) - draw.text((5, 20), '4.37inch e-Paper', font = font24, fill = epd.YELLOW) - draw.text((5, 45), u'微雪电子', font = font40, fill = epd.BLACK) - draw.text((5, 85), u'微雪电子', font = font40, fill = epd.YELLOW) - draw.text((5, 125), u'微雪电子', font = font40, fill = epd.RED) - - draw.line((5, 170, 80, 245), fill = epd.RED) - draw.line((80, 170, 5, 245), fill = epd.YELLOW) - draw.rectangle((5, 170, 80, 245), outline = epd.BLACK) - draw.rectangle((90, 170, 165, 245), fill = epd.YELLOW) - draw.arc((5, 250, 80, 325), 0, 360, fill = epd.BLACK) - draw.chord((90, 250, 165, 325), 0, 360, fill = epd.RED) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - # read bmp file - logging.info("2.read image file") - Himage = Image.open(os.path.join(picdir, '4in37g0.jpg')) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - logging.info("3.read image file") - Himage = Image.open(os.path.join(picdir, '4in37g1.jpg')) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - logging.info("4.read image file") - Himage = Image.open(os.path.join(picdir, '4in37g2.jpg')) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - logging.info("Clear...") - epd.Clear() - - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd4in37g.epdconfig.module_exit() - exit() diff --git a/examples/epd_5in65f_test.py b/examples/epd_5in65f_test.py deleted file mode 100644 index 7b79449..0000000 --- a/examples/epd_5in65f_test.py +++ /dev/null @@ -1,93 +0,0 @@ -#!/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 epd5in65f -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd5in65f Demo") - - epd = epd5in65f.EPD() - logging.info("init and Clear") - epd.init() - epd.Clear() - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - font30 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 40) - - # Drawing on the Horizontal image - logging.info("1.Drawing on the Horizontal image...") - Himage = Image.new('RGB', (epd.width, epd.height), 0xffffff) # 255: clear the frame - draw = ImageDraw.Draw(Himage) - draw.text((10, 0), 'hello world', font = font24, fill = 0) - draw.text((10, 20), '5.83inch e-Paper', font = font24, fill = 0) - draw.text((10, 160), u'微雪电子', font = font30, fill = epd.BLACK) - draw.text((10, 200), u'微雪电子', font = font30, fill = epd.ORANGE) - draw.text((10, 240), u'微雪电子', font = font30, fill = epd.GREEN) - draw.text((10, 280), u'微雪电子', font = font30, fill = epd.BLUE) - draw.text((10, 320), u'微雪电子', font = font30, fill = epd.RED) - draw.text((10, 360), u'微雪电子', font = font30, fill = epd.YELLOW) - 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) - draw.chord((200, 50, 250, 100), 0, 360, fill = 0) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - # logging.info("2.Drawing on the Vertical image...") - Himage = Image.new('RGB', (epd.height, epd.width), 0xffffff) # 255: clear the frame - draw = ImageDraw.Draw(Himage) - draw.text((10, 0), 'hello world', font = font24, fill = 0) - draw.text((10, 20), '5.83inch e-Paper', font = font24, fill = 0) - draw.text((10, 160), u'微雪电子', font = font30, fill = epd.BLACK) - draw.text((10, 200), u'微雪电子', font = font30, fill = epd.ORANGE) - draw.text((10, 240), u'微雪电子', font = font30, fill = epd.GREEN) - draw.text((10, 280), u'微雪电子', font = font30, fill = epd.BLUE) - draw.text((10, 320), u'微雪电子', font = font30, fill = epd.RED) - draw.text((10, 360), u'微雪电子', font = font30, fill = epd.YELLOW) - 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) - draw.chord((200, 50, 250, 100), 0, 360, fill = 0) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - logging.info("3.read bmp file") - Himage = Image.open(os.path.join(picdir, '5in65f0.bmp')) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - Himage = Image.open(os.path.join(picdir, '5in65f.bmp')) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - epd.Clear() - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd5in65f.epdconfig.module_exit() - exit() diff --git a/examples/epd_5in83_V2_test.py b/examples/epd_5in83_V2_test.py deleted file mode 100644 index d63746e..0000000 --- a/examples/epd_5in83_V2_test.py +++ /dev/null @@ -1,89 +0,0 @@ -#!/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 epd5in83_V2 -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd5in83_V2 Demo") - - epd = epd5in83_V2.EPD() - logging.info("init and Clear") - epd.init() - # epd.Clear() - - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - - # Drawing on the Horizontal image - logging.info("1.Drawing on the Horizontal image...") - Himage = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame - draw = ImageDraw.Draw(Himage) - 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) - draw.chord((200, 50, 250, 100), 0, 360, fill = 0) - epd.display(epd.getbuffer(Himage)) - time.sleep(2) - - # Drawing on the Vertical image - logging.info("2.Drawing on the Vertical image...") - Limage = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - draw = ImageDraw.Draw(Limage) - draw.text((2, 0), 'hello world', font = font18, fill = 0) - draw.text((2, 20), '5.83inch epd', font = font18, fill = 0) - draw.text((20, 50), u'微雪电子', font = font18, fill = 0) - draw.line((10, 90, 60, 140), fill = 0) - draw.line((60, 90, 10, 140), fill = 0) - draw.rectangle((10, 90, 60, 140), outline = 0) - draw.line((95, 90, 95, 140), fill = 0) - draw.line((70, 115, 120, 115), fill = 0) - draw.arc((70, 90, 120, 140), 0, 360, fill = 0) - draw.rectangle((10, 150, 60, 200), fill = 0) - draw.chord((70, 150, 120, 200), 0, 360, fill = 0) - epd.display(epd.getbuffer(Limage)) - time.sleep(2) - - logging.info("3.read bmp file") - Himage = Image.open(os.path.join(picdir, '5in83_V2.bmp')) - epd.display(epd.getbuffer(Himage)) - time.sleep(2) - - logging.info("4.read bmp file on window") - Himage2 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - bmp = Image.open(os.path.join(picdir, '100x100.bmp')) - Himage2.paste(bmp, (50,10)) - epd.display(epd.getbuffer(Himage2)) - time.sleep(2) - - logging.info("Clear...") - epd.Clear() - - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd5in83_V2.epdconfig.module_exit() - exit() diff --git a/examples/epd_5in83_test.py b/examples/epd_5in83_test.py deleted file mode 100644 index ef69892..0000000 --- a/examples/epd_5in83_test.py +++ /dev/null @@ -1,90 +0,0 @@ -#!/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 epd5in83 -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd5in83 Demo") - - epd = epd5in83.EPD() - logging.info("init and Clear") - epd.init() - epd.Clear() - - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - - # Drawing on the Horizontal image - logging.info("1.Drawing on the Horizontal image...") - Himage = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame - draw = ImageDraw.Draw(Himage) - 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) - draw.chord((200, 50, 250, 100), 0, 360, fill = 0) - epd.display(epd.getbuffer(Himage)) - time.sleep(2) - - # Drawing on the Vertical image - logging.info("2.Drawing on the Vertical image...") - Limage = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - draw = ImageDraw.Draw(Limage) - draw.text((2, 0), 'hello world', font = font18, fill = 0) - draw.text((2, 20), '5.83inch epd', font = font18, fill = 0) - draw.text((20, 50), u'微雪电子', font = font18, fill = 0) - draw.line((10, 90, 60, 140), fill = 0) - draw.line((60, 90, 10, 140), fill = 0) - draw.rectangle((10, 90, 60, 140), outline = 0) - draw.line((95, 90, 95, 140), fill = 0) - draw.line((70, 115, 120, 115), fill = 0) - draw.arc((70, 90, 120, 140), 0, 360, fill = 0) - draw.rectangle((10, 150, 60, 200), fill = 0) - draw.chord((70, 150, 120, 200), 0, 360, fill = 0) - epd.display(epd.getbuffer(Limage)) - time.sleep(2) - - logging.info("3.read bmp file") - Himage = Image.open(os.path.join(picdir, '5in83.bmp')) - epd.display(epd.getbuffer(Himage)) - time.sleep(2) - - logging.info("4.read bmp file on window") - Himage2 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - bmp = Image.open(os.path.join(picdir, '100x100.bmp')) - Himage2.paste(bmp, (50,10)) - epd.display(epd.getbuffer(Himage2)) - time.sleep(2) - - logging.info("Clear...") - epd.init() - epd.Clear() - - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd5in83.epdconfig.module_exit() - exit() diff --git a/examples/epd_5in83b_V2_test.py b/examples/epd_5in83b_V2_test.py deleted file mode 100644 index 6ffa112..0000000 --- a/examples/epd_5in83b_V2_test.py +++ /dev/null @@ -1,99 +0,0 @@ -#!/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 epd5in83b_V2 -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd5in83b_V2 Demo") - - epd = epd5in83b_V2.EPD() - logging.info("init and Clear") - epd.init() - epd.Clear() - time.sleep(1) - - # Drawing on the image - logging.info("Drawing") - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - - # Drawing on the Horizontal image - logging.info("1.Drawing on the Horizontal image...") - HBlackimage = Image.new('1', (epd.width, epd.height), 255) # 648*480 - HRYimage = Image.new('1', (epd.width, epd.height), 255) # 648*480 HRYimage: red or yellow image - drawblack = ImageDraw.Draw(HBlackimage) - drawry = ImageDraw.Draw(HRYimage) - drawblack.text((10, 0), 'hello world', font = font24, fill = 0) - drawblack.text((10, 20), '5.83inch e-Paper b V2', font = font24, fill = 0) - drawblack.text((150, 0), u'微雪电子', font = font24, fill = 0) - drawblack.line((20, 50, 70, 100), fill = 0) - drawblack.line((70, 50, 20, 100), fill = 0) - drawblack.rectangle((20, 50, 70, 100), outline = 0) - drawry.line((165, 50, 165, 100), fill = 0) - drawry.line((140, 75, 190, 75), fill = 0) - drawry.arc((140, 50, 190, 100), 0, 360, fill = 0) - drawry.rectangle((80, 50, 130, 100), fill = 0) - drawry.chord((200, 50, 250, 100), 0, 360, fill = 0) - epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage)) - time.sleep(2) - - # Drawing on the Vertical image - logging.info("2.Drawing on the Vertical image...") - LBlackimage = Image.new('1', (epd.height, epd.width), 255) - LRYimage = Image.new('1', (epd.height, epd.width), 255) - drawblack = ImageDraw.Draw(LBlackimage) - drawry = ImageDraw.Draw(LRYimage) - - drawblack.text((2, 0), 'hello world', font = font18, fill = 0) - drawblack.text((2, 20), '5.83inch epd b V2', font = font18, fill = 0) - drawblack.text((20, 50), u'微雪电子', font = font18, fill = 0) - drawblack.line((10, 90, 60, 140), fill = 0) - drawblack.line((60, 90, 10, 140), fill = 0) - drawblack.rectangle((10, 90, 60, 140), outline = 0) - drawry.line((95, 90, 95, 140), fill = 0) - drawry.line((70, 115, 120, 115), fill = 0) - drawry.arc((70, 90, 120, 140), 0, 360, fill = 0) - drawry.rectangle((10, 150, 60, 200), fill = 0) - drawry.chord((70, 150, 120, 200), 0, 360, fill = 0) - epd.display(epd.getbuffer(LBlackimage), epd.getbuffer(LRYimage)) - time.sleep(2) - - logging.info("3.read bmp file") - HBlackimage = Image.open(os.path.join(picdir, '5in83b_V2_b.bmp')) - HRYimage = Image.open(os.path.join(picdir, '5in83b_V2_r.bmp')) - epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage)) - time.sleep(2) - - logging.info("4.read bmp file on window") - blackimage1 = Image.new('1', (epd.width, epd.height), 255) - redimage1 = Image.new('1', (epd.width, epd.height), 255) - newimage = Image.open(os.path.join(picdir, '100x100.bmp')) - blackimage1.paste(newimage, (50,10)) - epd.display(epd.getbuffer(blackimage1), epd.getbuffer(redimage1)) - - logging.info("Clear...") - epd.init() - epd.Clear() - - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd5in83b_V2.epdconfig.module_exit() - exit() diff --git a/examples/epd_5in83bc_test.py b/examples/epd_5in83bc_test.py deleted file mode 100644 index 5f12bfc..0000000 --- a/examples/epd_5in83bc_test.py +++ /dev/null @@ -1,99 +0,0 @@ -#!/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 epd5in83bc -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd5in83bc Demo") - - epd = epd5in83bc.EPD() - logging.info("init and Clear") - epd.init() - epd.Clear() - time.sleep(1) - - # Drawing on the image - logging.info("Drawing") - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - - # Drawing on the Horizontal image - logging.info("1.Drawing on the Horizontal image...") - HBlackimage = Image.new('1', (epd.width, epd.height), 255) # 298*126 - HRYimage = Image.new('1', (epd.width, epd.height), 255) # 298*126 ryimage: red or yellow image - drawblack = ImageDraw.Draw(HBlackimage) - drawry = ImageDraw.Draw(HRYimage) - drawblack.text((10, 0), 'hello world', font = font24, fill = 0) - drawblack.text((10, 20), '5.83inch e-Paper bc', font = font24, fill = 0) - drawblack.text((150, 0), u'微雪电子', font = font24, fill = 0) - drawblack.line((20, 50, 70, 100), fill = 0) - drawblack.line((70, 50, 20, 100), fill = 0) - drawblack.rectangle((20, 50, 70, 100), outline = 0) - drawry.line((165, 50, 165, 100), fill = 0) - drawry.line((140, 75, 190, 75), fill = 0) - drawry.arc((140, 50, 190, 100), 0, 360, fill = 0) - drawry.rectangle((80, 50, 130, 100), fill = 0) - drawry.chord((200, 50, 250, 100), 0, 360, fill = 0) - epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage)) - time.sleep(2) - - # Drawing on the Vertical image - logging.info("2.Drawing on the Vertical image...") - LBlackimage = Image.new('1', (epd.height, epd.width), 255) # 126*298 - LRYimage = Image.new('1', (epd.height, epd.width), 255) # 126*298 - drawblack = ImageDraw.Draw(LBlackimage) - drawry = ImageDraw.Draw(LRYimage) - - drawblack.text((2, 0), 'hello world', font = font18, fill = 0) - drawblack.text((2, 20), '5.83inch epd bc', font = font18, fill = 0) - drawblack.text((20, 50), u'微雪电子', font = font18, fill = 0) - drawblack.line((10, 90, 60, 140), fill = 0) - drawblack.line((60, 90, 10, 140), fill = 0) - drawblack.rectangle((10, 90, 60, 140), outline = 0) - drawry.line((95, 90, 95, 140), fill = 0) - drawry.line((70, 115, 120, 115), fill = 0) - drawry.arc((70, 90, 120, 140), 0, 360, fill = 0) - drawry.rectangle((10, 150, 60, 200), fill = 0) - drawry.chord((70, 150, 120, 200), 0, 360, fill = 0) - epd.display(epd.getbuffer(LBlackimage), epd.getbuffer(LRYimage)) - time.sleep(2) - - logging.info("3.read bmp file") - HBlackimage = Image.open(os.path.join(picdir, '5in83bc-b.bmp')) - HRYimage = Image.open(os.path.join(picdir, '5in83bc-ry.bmp')) - epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage)) - time.sleep(2) - - logging.info("4.read bmp file on window") - blackimage1 = Image.new('1', (epd.width, epd.height), 255) # 298*126 - redimage1 = Image.new('1', (epd.width, epd.height), 255) # 298*126 - newimage = Image.open(os.path.join(picdir, '100x100.bmp')) - blackimage1.paste(newimage, (50,10)) - epd.display(epd.getbuffer(blackimage1), epd.getbuffer(redimage1)) - - logging.info("Clear...") - epd.init() - epd.Clear() - - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd5in83bc.epdconfig.module_exit() - exit() diff --git a/examples/epd_7in3g_test.py b/examples/epd_7in3g_test.py deleted file mode 100644 index e70cc92..0000000 --- a/examples/epd_7in3g_test.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/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 epd7in3g -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd7in3g Demo") - - epd = epd7in3g.EPD() - logging.info("init and Clear") - epd.init() - epd.Clear() - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - font40 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 40) - - # Drawing on the image - logging.info("1.Drawing on the image...") - Himage = Image.new('RGB', (epd.width, epd.height), epd.WHITE) # 255: clear the frame - draw = ImageDraw.Draw(Himage) - draw.text((5, 0), 'hello world', font = font18, fill = epd.RED) - draw.text((5, 20), '7.3inch e-Paper', font = font24, fill = epd.YELLOW) - draw.text((5, 45), u'微雪电子', font = font40, fill = epd.BLACK) - draw.text((5, 85), u'微雪电子', font = font40, fill = epd.YELLOW) - draw.text((5, 125), u'微雪电子', font = font40, fill = epd.RED) - - draw.line((5, 170, 80, 245), fill = epd.RED) - draw.line((80, 170, 5, 245), fill = epd.YELLOW) - draw.rectangle((5, 170, 80, 245), outline = epd.BLACK) - draw.rectangle((90, 170, 165, 245), fill = epd.YELLOW) - draw.arc((5, 250, 80, 325), 0, 360, fill = epd.BLACK) - draw.chord((90, 250, 165, 325), 0, 360, fill = epd.RED) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - # read bmp file - logging.info("2.read bmp file") - Himage = Image.open(os.path.join(picdir, '7.3inch-1.bmp')) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - logging.info("3.read bmp file") - Himage = Image.open(os.path.join(picdir, '7.3inch-2.bmp')) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - logging.info("4.read bmp file") - Himage = Image.open(os.path.join(picdir, '7.3inch-3.bmp')) - epd.display(epd.getbuffer(Himage)) - time.sleep(3) - - logging.info("Clear...") - epd.Clear() - - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd7in3g.epdconfig.module_exit() - exit() diff --git a/examples/epd_7in5_HD_test.py b/examples/epd_7in5_HD_test.py deleted file mode 100644 index 3f7b77c..0000000 --- a/examples/epd_7in5_HD_test.py +++ /dev/null @@ -1,90 +0,0 @@ -#!/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 epd7in5_HD -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd7in5_HD Demo") - - epd = epd7in5_HD.EPD() - logging.info("init and Clear") - epd.init() - epd.Clear() - - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - - # Drawing on the Horizontal image - logging.info("1.Drawing on the Horizontal image...") - Himage = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame - draw = ImageDraw.Draw(Himage) - draw.text((10, 0), 'hello world', font = font24, fill = 0) - draw.text((10, 20), '7.5inch 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) - draw.chord((200, 50, 250, 100), 0, 360, fill = 0) - epd.display(epd.getbuffer(Himage)) - time.sleep(2) - - # Drawing on the Vertical image - logging.info("2.Drawing on the Vertical image...") - Limage = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - draw = ImageDraw.Draw(Limage) - draw.text((2, 0), 'hello world', font = font18, fill = 0) - draw.text((2, 20), '7.5inch epd', font = font18, fill = 0) - draw.text((20, 50), u'微雪电子', font = font18, fill = 0) - draw.line((10, 90, 60, 140), fill = 0) - draw.line((60, 90, 10, 140), fill = 0) - draw.rectangle((10, 90, 60, 140), outline = 0) - draw.line((95, 90, 95, 140), fill = 0) - draw.line((70, 115, 120, 115), fill = 0) - draw.arc((70, 90, 120, 140), 0, 360, fill = 0) - draw.rectangle((10, 150, 60, 200), fill = 0) - draw.chord((70, 150, 120, 200), 0, 360, fill = 0) - epd.display(epd.getbuffer(Limage)) - time.sleep(2) - - logging.info("3.read bmp file") - Himage = Image.open(os.path.join(picdir, '7in5_HD.bmp')) - epd.display(epd.getbuffer(Himage)) - time.sleep(2) - - logging.info("4.read bmp file on window") - Himage2 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - bmp = Image.open(os.path.join(picdir, '100x100.bmp')) - Himage2.paste(bmp, (50,10)) - epd.display(epd.getbuffer(Himage2)) - time.sleep(2) - - logging.info("Clear...") - epd.init() - epd.Clear() - - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd7in5_HD.epdconfig.module_exit() - exit() diff --git a/examples/epd_7in5_V2_test.py b/examples/epd_7in5_V2_test.py deleted file mode 100644 index 38b0c78..0000000 --- a/examples/epd_7in5_V2_test.py +++ /dev/null @@ -1,90 +0,0 @@ -#!/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 epd7in5_V2 -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd7in5_V2 Demo") - epd = epd7in5_V2.EPD() - - logging.info("init and Clear") - epd.init() - epd.Clear() - - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - - # Drawing on the Horizontal image - logging.info("1.Drawing on the Horizontal image...") - Himage = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame - draw = ImageDraw.Draw(Himage) - draw.text((10, 0), 'hello world', font = font24, fill = 0) - draw.text((10, 20), '7.5inch 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) - draw.chord((200, 50, 250, 100), 0, 360, fill = 0) - epd.display(epd.getbuffer(Himage)) - time.sleep(2) - - # Drawing on the Vertical image - logging.info("2.Drawing on the Vertical image...") - Limage = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - draw = ImageDraw.Draw(Limage) - draw.text((2, 0), 'hello world', font = font18, fill = 0) - draw.text((2, 20), '7.5inch epd', font = font18, fill = 0) - draw.text((20, 50), u'微雪电子', font = font18, fill = 0) - draw.line((10, 90, 60, 140), fill = 0) - draw.line((60, 90, 10, 140), fill = 0) - draw.rectangle((10, 90, 60, 140), outline = 0) - draw.line((95, 90, 95, 140), fill = 0) - draw.line((70, 115, 120, 115), fill = 0) - draw.arc((70, 90, 120, 140), 0, 360, fill = 0) - draw.rectangle((10, 150, 60, 200), fill = 0) - draw.chord((70, 150, 120, 200), 0, 360, fill = 0) - epd.display(epd.getbuffer(Limage)) - time.sleep(2) - - logging.info("3.read bmp file") - Himage = Image.open(os.path.join(picdir, '7in5_V2.bmp')) - epd.display(epd.getbuffer(Himage)) - time.sleep(2) - - logging.info("4.read bmp file on window") - Himage2 = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame - bmp = Image.open(os.path.join(picdir, '100x100.bmp')) - Himage2.paste(bmp, (50,10)) - epd.display(epd.getbuffer(Himage2)) - time.sleep(2) - - logging.info("Clear...") - epd.init() - epd.Clear() - - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd7in5_V2.epdconfig.module_exit() - exit() diff --git a/examples/epd_7in5_test.py b/examples/epd_7in5_test.py deleted file mode 100644 index 10dc1f2..0000000 --- a/examples/epd_7in5_test.py +++ /dev/null @@ -1,90 +0,0 @@ -#!/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 epd7in5 -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd7in5 Demo") - - epd = epd7in5.EPD() - logging.info("init and Clear") - epd.init() - epd.Clear() - - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - - # Drawing on the Horizontal image - logging.info("1.Drawing on the Horizontal image...") - Himage = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame - draw = ImageDraw.Draw(Himage) - draw.text((10, 0), 'hello world', font = font24, fill = 0) - draw.text((10, 20), '7.5inch 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) - draw.chord((200, 50, 250, 100), 0, 360, fill = 0) - epd.display(epd.getbuffer(Himage)) - time.sleep(2) - - # Drawing on the Vertical image - logging.info("2.Drawing on the Vertical image...") - Limage = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - draw = ImageDraw.Draw(Limage) - draw.text((2, 0), 'hello world', font = font18, fill = 0) - draw.text((2, 20), '7.5inch epd', font = font18, fill = 0) - draw.text((20, 50), u'微雪电子', font = font18, fill = 0) - draw.line((10, 90, 60, 140), fill = 0) - draw.line((60, 90, 10, 140), fill = 0) - draw.rectangle((10, 90, 60, 140), outline = 0) - draw.line((95, 90, 95, 140), fill = 0) - draw.line((70, 115, 120, 115), fill = 0) - draw.arc((70, 90, 120, 140), 0, 360, fill = 0) - draw.rectangle((10, 150, 60, 200), fill = 0) - draw.chord((70, 150, 120, 200), 0, 360, fill = 0) - epd.display(epd.getbuffer(Limage)) - time.sleep(2) - - logging.info("3.read bmp file") - Himage = Image.open(os.path.join(picdir, '7in5.bmp')) - epd.display(epd.getbuffer(Himage)) - time.sleep(2) - - logging.info("4.read bmp file on window") - Himage2 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - bmp = Image.open(os.path.join(picdir, '100x100.bmp')) - Himage2.paste(bmp, (50,10)) - epd.display(epd.getbuffer(Himage2)) - time.sleep(2) - - logging.info("Clear...") - epd.init() - epd.Clear() - - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd7in5.epdconfig.module_exit() - exit() diff --git a/examples/epd_7in5b_HD_test.py b/examples/epd_7in5b_HD_test.py deleted file mode 100644 index 432277b..0000000 --- a/examples/epd_7in5b_HD_test.py +++ /dev/null @@ -1,98 +0,0 @@ -#!/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 epd7in5b_HD -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd7in5b_HD Demo") - - epd = epd7in5b_HD.EPD() - - logging.info("init and Clear") - epd.init() - epd.Clear() - - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - - # Drawing on the Horizontal image - logging.info("1.Drawing on the Horizontal image...") - Himage = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame - Other = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame - draw_Himage = ImageDraw.Draw(Himage) - draw_other = ImageDraw.Draw(Other) - draw_Himage.text((10, 0), 'hello world', font = font24, fill = 0) - draw_Himage.text((10, 20), '7.5inch e-Paper', font = font24, fill = 0) - draw_Himage.text((150, 0), u'微雪电子', font = font24, fill = 0) - draw_other.line((20, 50, 70, 100), fill = 0) - draw_other.line((70, 50, 20, 100), fill = 0) - draw_other.rectangle((20, 50, 70, 100), outline = 0) - draw_other.line((165, 50, 165, 100), fill = 0) - draw_Himage.line((140, 75, 190, 75), fill = 0) - draw_Himage.arc((140, 50, 190, 100), 0, 360, fill = 0) - draw_Himage.rectangle((80, 50, 130, 100), fill = 0) - draw_Himage.chord((200, 50, 250, 100), 0, 360, fill = 0) - epd.display(epd.getbuffer(Himage),epd.getbuffer(Other)) - time.sleep(2) - - # Drawing on the Vertical image - logging.info("2.Drawing on the Vertical image...") - Limage = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - Limage_Other = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - draw_Himage = ImageDraw.Draw(Limage) - draw_Himage_Other = ImageDraw.Draw(Limage_Other) - draw_Himage.text((2, 0), 'hello world', font = font18, fill = 0) - draw_Himage.text((2, 20), '7.5inch epd', font = font18, fill = 0) - draw_Himage_Other.text((20, 50), u'微雪电子', font = font18, fill = 0) - draw_Himage_Other.line((10, 90, 60, 140), fill = 0) - draw_Himage_Other.line((60, 90, 10, 140), fill = 0) - draw_Himage_Other.rectangle((10, 90, 60, 140), outline = 0) - draw_Himage_Other.line((95, 90, 95, 140), fill = 0) - draw_Himage.line((70, 115, 120, 115), fill = 0) - draw_Himage.arc((70, 90, 120, 140), 0, 360, fill = 0) - draw_Himage.rectangle((10, 150, 60, 200), fill = 0) - draw_Himage.chord((70, 150, 120, 200), 0, 360, fill = 0) - epd.display(epd.getbuffer(Limage), epd.getbuffer(Limage_Other)) - time.sleep(2) - - logging.info("3.read bmp file...") - blackimage = Image.open(os.path.join(picdir, '7in5_HD_b.bmp')) - redimage = Image.open(os.path.join(picdir, '7in5_HD_r.bmp')) - epd.display(epd.getbuffer(blackimage),epd.getbuffer(redimage)) - time.sleep(1) - - logging.info("4.read bmp file on window") - Himage2 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - Himage2_Other = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - bmp = Image.open(os.path.join(picdir, '100x100.bmp')) - Himage2.paste(bmp, (50,10)) - Himage2_Other.paste(bmp, (50,300)) - epd.display(epd.getbuffer(Himage2), epd.getbuffer(Himage2_Other)) - time.sleep(2) - - logging.info("Clear...") - epd.init() - epd.Clear() - - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd7in5b_HD.epdconfig.module_exit() - exit() diff --git a/examples/epd_7in5b_V2_test.py b/examples/epd_7in5b_V2_test.py deleted file mode 100644 index 096e762..0000000 --- a/examples/epd_7in5b_V2_test.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/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 epd7in5b_V2 -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd7in5b_V2 Demo") - - epd = epd7in5b_V2.EPD() - logging.info("init and Clear") - epd.init() - epd.Clear() - - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - - # Drawing on the Horizontal image - logging.info("1.Drawing on the Horizontal image...") - Himage = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame - Other = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame - draw_Himage = ImageDraw.Draw(Himage) - draw_other = ImageDraw.Draw(Other) - draw_Himage.text((10, 0), 'hello world', font = font24, fill = 0) - draw_Himage.text((10, 20), '7.5inch e-Paper', font = font24, fill = 0) - draw_Himage.text((150, 0), u'微雪电子', font = font24, fill = 0) - draw_other.line((20, 50, 70, 100), fill = 0) - draw_other.line((70, 50, 20, 100), fill = 0) - draw_other.rectangle((20, 50, 70, 100), outline = 0) - draw_other.line((165, 50, 165, 100), fill = 0) - draw_Himage.line((140, 75, 190, 75), fill = 0) - draw_Himage.arc((140, 50, 190, 100), 0, 360, fill = 0) - draw_Himage.rectangle((80, 50, 130, 100), fill = 0) - draw_Himage.chord((200, 50, 250, 100), 0, 360, fill = 0) - epd.display(epd.getbuffer(Himage),epd.getbuffer(Other)) - time.sleep(2) - - # Drawing on the Vertical image - logging.info("2.Drawing on the Vertical image...") - Limage = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - Limage_Other = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - draw_Himage = ImageDraw.Draw(Limage) - draw_Himage_Other = ImageDraw.Draw(Limage_Other) - draw_Himage.text((2, 0), 'hello world', font = font18, fill = 0) - draw_Himage.text((2, 20), '7.5inch epd', font = font18, fill = 0) - draw_Himage_Other.text((20, 50), u'微雪电子', font = font18, fill = 0) - draw_Himage_Other.line((10, 90, 60, 140), fill = 0) - draw_Himage_Other.line((60, 90, 10, 140), fill = 0) - draw_Himage_Other.rectangle((10, 90, 60, 140), outline = 0) - draw_Himage_Other.line((95, 90, 95, 140), fill = 0) - draw_Himage.line((70, 115, 120, 115), fill = 0) - draw_Himage.arc((70, 90, 120, 140), 0, 360, fill = 0) - draw_Himage.rectangle((10, 150, 60, 200), fill = 0) - draw_Himage.chord((70, 150, 120, 200), 0, 360, fill = 0) - epd.display(epd.getbuffer(Limage), epd.getbuffer(Limage_Other)) - time.sleep(2) - - logging.info("3.read bmp file") - Himage = Image.open(os.path.join(picdir, '7in5_V2_b.bmp')) - Himage_Other = Image.open(os.path.join(picdir, '7in5_V2_r.bmp')) - epd.display(epd.getbuffer(Himage),epd.getbuffer(Himage_Other)) - time.sleep(2) - - logging.info("4.read bmp file on window") - Himage2 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - Himage2_Other = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame - bmp = Image.open(os.path.join(picdir, '2in9.bmp')) - Himage2.paste(bmp, (50,10)) - Himage2_Other.paste(bmp, (50,300)) - epd.display(epd.getbuffer(Himage2), epd.getbuffer(Himage2_Other)) - time.sleep(2) - - logging.info("Clear...") - epd.init() - epd.Clear() - - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd7in5b_V2.epdconfig.module_exit() - exit() diff --git a/examples/epd_7in5bc_test.py b/examples/epd_7in5bc_test.py deleted file mode 100644 index fbde0d4..0000000 --- a/examples/epd_7in5bc_test.py +++ /dev/null @@ -1,102 +0,0 @@ -#!/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 epd7in5bc -import time -from PIL import Image,ImageDraw,ImageFont -import traceback - -logging.basicConfig(level=logging.DEBUG) - -try: - logging.info("epd7in5bc Demo") - - epd = epd7in5bc.EPD() - - logging.info("init and Clear") - epd.init() - epd.Clear() - time.sleep(1) - - # Drawing on the image - logging.info("Drawing") - font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) - font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) - - # Drawing on the Horizontal image - logging.info("1.Drawing on the Horizontal image...") - HBlackimage = Image.new('1', (epd.width, epd.height), 255) # 298*126 - HRYimage = Image.new('1', (epd.width, epd.height), 255) # 298*126 ryimage: red or yellow image - drawblack = ImageDraw.Draw(HBlackimage) - drawry = ImageDraw.Draw(HRYimage) - drawblack.text((10, 0), 'hello world', font = font24, fill = 0) - drawblack.text((10, 20), '7.5inch e-Paper bc', font = font24, fill = 0) - drawblack.text((150, 0), u'微雪电子', font = font24, fill = 0) - drawblack.line((20, 50, 70, 100), fill = 0) - drawblack.line((70, 50, 20, 100), fill = 0) - drawblack.rectangle((20, 50, 70, 100), outline = 0) - drawry.line((165, 50, 165, 100), fill = 0) - drawry.line((140, 75, 190, 75), fill = 0) - drawry.arc((140, 50, 190, 100), 0, 360, fill = 0) - drawry.rectangle((80, 50, 130, 100), fill = 0) - drawry.chord((200, 50, 250, 100), 0, 360, fill = 0) - epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage)) - time.sleep(2) - - # Drawing on the Vertical image - logging.info("2.Drawing on the Vertical image...") - LBlackimage = Image.new('1', (epd.height, epd.width), 255) # 126*298 - LRYimage = Image.new('1', (epd.height, epd.width), 255) # 126*298 - drawblack = ImageDraw.Draw(LBlackimage) - drawry = ImageDraw.Draw(LRYimage) - - drawblack.text((2, 0), 'hello world', font = font18, fill = 0) - drawblack.text((2, 20), '7.5inch epd bc', font = font18, fill = 0) - drawblack.text((20, 50), u'微雪电子', font = font18, fill = 0) - drawblack.line((10, 90, 60, 140), fill = 0) - drawblack.line((60, 90, 10, 140), fill = 0) - drawblack.rectangle((10, 90, 60, 140), outline = 0) - drawry.line((95, 90, 95, 140), fill = 0) - drawry.line((70, 115, 120, 115), fill = 0) - drawry.arc((70, 90, 120, 140), 0, 360, fill = 0) - drawry.rectangle((10, 150, 60, 200), fill = 0) - drawry.chord((70, 150, 120, 200), 0, 360, fill = 0) - epd.display(epd.getbuffer(LBlackimage), epd.getbuffer(LRYimage)) - time.sleep(2) - - logging.info("3.read bmp file") - HBlackimage = Image.open(os.path.join(picdir, '7in5b-b.bmp')) - HRYimage = Image.open(os.path.join(picdir, '7in5b-r.bmp')) - # HBlackimage = Image.open(os.path.join(picdir, '7in5c-b.bmp')) - # HRYimage = Image.open(os.path.join(picdir, '7in5c-r.bmp')) - epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage)) - time.sleep(2) - - logging.info("4.read bmp file on window") - blackimage1 = Image.new('1', (epd.width, epd.height), 255) # 298*126 - redimage1 = Image.new('1', (epd.width, epd.height), 255) # 298*126 - newimage = Image.open(os.path.join(picdir, '100x100.bmp')) - blackimage1.paste(newimage, (50,10)) - epd.display(epd.getbuffer(blackimage1), epd.getbuffer(redimage1)) - - logging.info("Clear...") - epd.init() - epd.Clear() - - logging.info("Goto Sleep...") - epd.sleep() - -except IOError as e: - logging.info(e) - -except KeyboardInterrupt: - logging.info("ctrl + c:") - epd7in5bc.epdconfig.module_exit() - exit()