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 time
|
||||
import logging
|
||||
@@ -26,18 +27,22 @@ def main():
|
||||
epd = epd4in0e.EPD()
|
||||
epd.init()
|
||||
epd.Clear()
|
||||
# font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18)
|
||||
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)
|
||||
|
||||
img = Image.new('RGB', (epd.width, epd.height), epd.WHITE) # 255: clear the frame
|
||||
draw = ImageDraw.Draw(img)
|
||||
logger.info('zeichne blaue Linie')
|
||||
draw.line((0,0, 80, 245), fill = epd.BLUE)
|
||||
epd.display(epd.getbuffer(Himage))
|
||||
draw.line((0,0, 115, 255), width=3, fill = epd.BLUE)
|
||||
|
||||
logger.info('zeichne gefülltes Rechteck')
|
||||
draw.rectangle((90, 170, 165, 245), fill = epd.RED)
|
||||
epd.display(epd.getbuffer(Himage))
|
||||
logger.info('zeichne gefülltes Qudarat')
|
||||
draw.rectangle((0,170, 75, 245), fill = epd.RED)
|
||||
|
||||
|
||||
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)
|
||||
logger.info('cleanup')
|
||||
|
||||
Reference in New Issue
Block a user