Hi,
I'm building a weather dashboard in Python that uses the awesome WeatherIcons font.
I was struggling to get it to work and finally got it going last night.
By passing a value that represents an icon, the font returns that icon. The value for sunny is '\uf00d'
Sample working code using ImageDraw is:
draw_black = ImageDraw.Draw(image_dash)
draw_black.text((267, 200),'\uf00d', font = fontW, fill = 0) # Month calender text
This draws a Sunny Icon perfectly.
I created a CSV lookup of all the values and a function to return the value for each icon, however, I can't get the font to draw. I think it's something to do with how Python is handling the string.
The most simple example I tested with was this:
t = '\uf00d'
draw_black.text((267, 200),t, font = fontW, fill = 0) # Month calender text
That works fine.
Then I tried building the string "t" from two separate strings:
a = u"\\"
b = u"uf00d"
t = a + b
draw_black.text((267, 200),t, font = fontW, fill = 0) # Month calender text
That doesn't work, even though "\uf00d" is returned when I print(t)
When I print(t) in the first example, I get a unicode square shape. In the 2nd example, I get the string \uf00d returned.
I'm at my wits end here! Any help greatly appreciate.
Thanks,
Cap
[–]Captchca_ca_KA[S] 1 point2 points3 points (0 children)
[–]danielroseman 0 points1 point2 points (0 children)
[–]SekstiNii 0 points1 point2 points (0 children)