weather.py 805 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/usr/bin/python3
  2. # -*- coding:utf-8 -*-
  3. import sys
  4. import os
  5. libdir = "/home/pi/src/e-Paper/RaspberryPi_JetsonNano/python/lib"
  6. picdir = "/home/pi/src/e-Paper/RaspberryPi_JetsonNano/python/pic"
  7. if os.path.exists(libdir):
  8. sys.path.append(libdir)
  9. import logging
  10. from waveshare_epd import epd7in5_V2
  11. import time
  12. from PIL import Image,ImageDraw,ImageFont
  13. import traceback
  14. logging.basicConfig(level=logging.DEBUG)
  15. try:
  16. epd = epd7in5_V2.EPD()
  17. epd.init()
  18. # epd.Clear()
  19. Himage = Image.open(os.path.join(picdir, '/tmp/weather/weather.bmp')).transpose(Image.ROTATE_180)
  20. epd.display(epd.getbuffer(Himage))
  21. epd.sleep()
  22. except IOError as e:
  23. logging.info(e)
  24. except KeyboardInterrupt:
  25. logging.info("ctrl + c:")
  26. epd7in5_V2.epdconfig.module_exit()
  27. exit()