We have 4 info on screen but that is not all, awaiting are humidity, clouds and overall weather description.
Humidity and clouds are percentage values. We need something clever to show them. But what?
For cloud let’s check a cloud icon fully visible up to value and rest just an outline. Two images displayed with proper width. The effect is very good:
On the left, we have 50% and on the right 70%.
Those icons are good enough. The last thing left is an overall weather information. It has 53 possible states. Too much!
Look into the service/openweather_codes.py there is a list of all possible states. What we gonna do is to go from first to last and think if we can quickly create an icon.
If we have some strength, like light rain, heavy rain we will indicate it via a number of drops. Same with thunderstorms, we will mark strength with thunders. Hopefully, this can be a good thing.
And there is one more thing, it is not wise to load all icons at once 🙂 We will do a small trick, all states will be in icon dictionary but only as key. We will load them as needed.
'200': None, '201': None, '202': None, (..)
And load function:
def _get_weather_icon(self, status): """load weather icon when needed""" if self.icon[status] is None: self.icon[status] = Image.open('assets/image/openweather/'+str(status)+".png") return self.icon[status]
We are not clearing unused icons. I do not know if this will become a problem.
What about icons?
Quick googling shows me a nice site with plenty of free weather icons: www.flaticon.com, especially those made by Freepik and Linector. Merging free icons with my own ideas I should be able to create all of them.Many hours later.. I have them! Yey!
Many hours later.. I have them! Yey!
They are not perfect but easily readable. I didn’t know that there are 30 rain states 🙂
Now only hook images to tiles…. and here it is.
Short post but very hard and long work. I’m no graphical specialist so it was really hard to me. But it was worth. We have now a beautiful weather widget.