zeichnen des gelben Kreises und abspeichern des Ergebnis.
This commit is contained in:
BIN
spi_demo.jpg
Normal file
BIN
spi_demo.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.3 KiB |
25
spi_demo.py
Normal file → Executable file
25
spi_demo.py
Normal file → Executable file
@@ -1,3 +1,4 @@
|
|||||||
|
#! /usr/bin/python
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import logging
|
import logging
|
||||||
@@ -26,18 +27,22 @@ def main():
|
|||||||
epd = epd4in0e.EPD()
|
epd = epd4in0e.EPD()
|
||||||
epd.init()
|
epd.init()
|
||||||
epd.Clear()
|
epd.Clear()
|
||||||
# font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18)
|
img = Image.new('RGB', (epd.width, epd.height), epd.WHITE) # 255: clear the frame
|
||||||
Himage = Image.new('RGB', (epd.width, epd.height), epd.WHITE) # 255: clear the frame
|
draw = ImageDraw.Draw(img)
|
||||||
draw = ImageDraw.Draw(Himage)
|
|
||||||
# draw.text((5, 0), 'hello world', font = font18, fill = epd.RED)
|
|
||||||
|
|
||||||
logger.info('zeichne blaue Linie')
|
logger.info('zeichne blaue Linie')
|
||||||
draw.line((0,0, 80, 245), fill = epd.BLUE)
|
draw.line((0,0, 115, 255), width=3, fill = epd.BLUE)
|
||||||
epd.display(epd.getbuffer(Himage))
|
|
||||||
|
|
||||||
logger.info('zeichne gefülltes Rechteck')
|
logger.info('zeichne gefülltes Qudarat')
|
||||||
draw.rectangle((90, 170, 165, 245), fill = epd.RED)
|
draw.rectangle((0,170, 75, 245), fill = epd.RED)
|
||||||
epd.display(epd.getbuffer(Himage))
|
|
||||||
|
|
||||||
|
logger.info('zeichne gefüllten Kreis')
|
||||||
|
draw.circle((105,180),20,fill=epd.YELLOW)
|
||||||
|
# Erst, wenn alles gezeichnet ist, aktualisieren wir das Display.
|
||||||
|
epd.display(epd.getbuffer(img))
|
||||||
|
|
||||||
|
# speichern des Bilds im akzuellen Verzeichnis
|
||||||
|
img.save('spi_demo.jpg')
|
||||||
|
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
logger.info('cleanup')
|
logger.info('cleanup')
|
||||||
|
|||||||
Reference in New Issue
Block a user