I was playing around with the code in the manual to get the current weather conditions from the yahoo website and I came across a very easy way to add weather icons for the different conditions.
First I added a piece of code that would get a weather icon code from the same place that it gets the conditions and temperature:
iconcode = re.compile('.*?code="(.*?)"').match(subText).group(1)
Then I put wrote that code into a db tag:
system.tag.writeToTag("Gateway Tags/Weather Icon Code",iconcode)
Then I found this cool icon pack that matches up exactly with Yahoo’s weather codes (I’ll add it as an attachment)
Now you just have to run a script to put the code number from Yahoo into the path for the icons like so:
window = system.gui.getWindow('Main Window')
weathericon = window.rootContainer.getComponent('WeatherCondition')
condition = system.tag.getTagValue("Gateway Tags/Weather Icon Code")
weathericon.path = "Weather/" + condition + ".png"
Bam! Easy weather icons.
weather_png.zip (1.03 MB)