If you are getting the error 'list indices must be integers or slices, not str' for any of the ['weather'] json formatting, instead of: icon = json['weather']['main'] use: icon = json['weather'][0]['main'] They must have change the format of the json file.
Hi, i try to run the code but i got error.. Do i have to install tkinter on my python command prompt first? I looked for the video, i didn't find it.. pls help. thanks
For those not able to get 'bitmap' to work I manage to make it work with this change: icon_ref = PhotoImage(file='folderwhereiconislocated/{}.png'.format(weather[3])) image['image'] = icon_ref image.image = icon_ref # must keep a reference of icon or else image will be transparent # change option to 'image' inside Label image = Label(app, image='') effbot.org/pyfaq/why-do-my-tkinter-images-not-appear.htm#:~:text=When%20you%20add%20a%20PhotoImage,won't%20always%20show%20up.&text=When%20Python's%20garbage%20collector%20discards,Tk%20to%20release%20the%20image.
I can't get this to work for the life of me. 4 hours later and still no luck. so many TCL errors. Is there anywhere I could see the entire code that actually use the weather icons???
***For those who are having problems with icons!*** What I did is that I created a "global img" inside the Search() function. After that, I set the "file" section of the img to the icon given from the API: img["file"] = 'your file location\\{}.png'.format(weather[4]) Then I avoided using bitmap. Instead of bitmap I used image. img = PhotoImage(file= " ") Image = Label(root, image = img) Image.pack()
@@Farhan-pn1hg he didn't do this in the video where I'm at so far, but the icons default save as 50d@2x.png. You gotta add the @2x part after {} and before .png in the code.