Weather with Python, TkInter, Raspberry Pi…

Just messing around this weekend with some Python and TkInter. I put together a little weather app which uses Weather Underground’s API to grab the current local weather conditions (or the weather conditions from the state and city specified in the script) and creates a window to display the weather using TkInter widgets.

The script is available on GitHub. You will need a Weather Underground API Key which you can get for free. The free key allows 500 free API calls per day.

The following information about the current weather conditions is displayed: observation location, observation time, weather conditions (clear, cloudy, etc), a visible representation (icon) of the current conditions, temperature in Fahrenheit, and relative humidity. Here is what my weather app looks like running on the Raspberry Pi.

Took me a bit to make the icon image to display correctly. The code snippet Display an Image from a URL (Tkinter, Python) helped me get it working.

I was messing on the Raspberry Pi, but I was able to get it to work with Python on Windows as well.

Weather Underground’s API has a lot more information. Things like wind direction and speed, amount of participation, visibility, and a bunch more. Would be pretty easy to expand this out display more.

Just a fun little project to learn something new on a Saturday evening. In case you missed earlier the Python code for my Weather app is on GitHub if you want to have a look.


Introducing Python
Python Cookbook


Hersey Cartwright is an IT professional with extensive experience designing, implementing, managing, and supporting technologies that improve business processes. Hersey is Solutions Architect for HPE SimpliVity covering Virginia, Washington DC, and Maryland. He holds the VMware Certified Design Expert (VCDX-DV #128) certification. Hersey actively participates in the VMware community and was awarded the VMware vExpert title in 2016, 2015, 2014, 2013, and 2012. He enjoys working with, teaching, and writing about virtualization and other data center technologies. Follow Hersey on Twitter @herseyc

Leave a Reply

Your email address will not be published. Required fields are marked *