Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update interactive_weather_plot.py
I am using Python 3.11.3 I was having this error : "TypeError: 'dict_keys' object is not subscriptable" locations.keys() had to be explicitly converted into list to prevent this exception.
  • Loading branch information
TsKyrk authored Aug 25, 2023
commit 4767cfd0f306650f185c8b196fa02754db9d827a
4 changes: 2 additions & 2 deletions general/interactive-weather-plot/interactive_weather_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def changeLocation(newLocation):
# Making the Radio Buttons
buttons = RadioButtons(
ax=plt.axes([0.1, 0.1, 0.2, 0.2]),
labels=locations.keys()
labels=list(locations.keys())
)

# Connect click event on the buttons to the function that changes location.
Expand All @@ -86,4 +86,4 @@ def changeLocation(newLocation):

plt.savefig('file.svg', format='svg')

plt.show()
plt.show()