zeichnen des gelben Kreises und abspeichern des Ergebnis.

This commit is contained in:
2025-12-12 07:15:23 +01:00
parent 2e354de75f
commit 2c4ad47734
2 changed files with 15 additions and 10 deletions

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
View 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')