pimoroni / scroll-phat-hd

Python library for Scroll pHAT HD
https://shop.pimoroni.com/products/scroll-phat-hd
MIT License
159 stars 64 forks source link

adds precip.py #49

Closed brentajones closed 6 years ago

brentajones commented 6 years ago

precip.py is a script to graphically represent weather conditions on the Scroll pHat HD. It is configurable from the command line.

Note: Haven't tested this on Python 3.

dglaude commented 6 years ago

Is that the thunder demo we saw on Twitter?

So it does more than just rain and thunder... I can't wait to see snow and other. :-)

brentajones commented 6 years ago

It is! And it does! You could even do lightning and snow at the same time if you wanted.

I was trying to work up a demo mode that would transition between the different patterns (or even just slowly randomly modify the conditions) but I couldn't quite get it to work. Might keep hacking on it.

Gadgetoid commented 6 years ago

Fantastic stuff! If you could get a more dynamic system working, it could then potentially display the actual weather (or the forecasted version of it anyway) in your chosen city.

Gadgetoid commented 6 years ago

Ooh, one thing I should have noticed before rushing to merge this ;)

pi@raspberry:~/scroll-phat-hd/examples $ python3 precip.py
Traceback (most recent call last):
  File "precip.py", line 296, in <module>
    for x in xrange(width):
NameError: name 'xrange' is not defined

xrange is deprecated, and you should use range with appropriate bounds.

It's a good habit to use python3 to run your scripts, so you don't get caught by incompatibilities, or end up using obsolete/deprecated patterns/methods.