ebb/weather.py

11 lines
518 B
Python

proc = subprocess.Popen(["curl", "wttr.in"], stdout=subprocess.PIPE)
(out, err) = proc.communicate()
#display the weather
Limage = Image.new('1', (epd4in2.EPD_HEIGHT, epd4in2.EPD_WIDTH), 255) # 255: clear the frame
draw = ImageDraw.Draw(Limage)
font12 = ImageFont.truetype('/usr/share/fonts/truetype/wqy/wqy-microhei.ttc', 12)
draw.text((10, 0), out, font = font12, fill = 0)
epd.display(epd.getbuffer(Limage))
time.sleep(1)
epd.sleep()