I have a canvas c that I drew a graph on, and now I want to label the points of the graph. For whatever reason, the graph is working, but not the labels.
countries = starcoords.keys() #returns a list of all the countries I want to work with
for i in countries: #this part works
(xcor1, ycor1) = starcoords[i][1] #basically, returns the coordinates of the country i'm working with
for j in starcoords[i][2]: #starcoords[key][2] is a list of all the countries it connects to, then it goes through and draws lines to each country
(xcor2, ycor2) = starcoords[j][1]
if starcoords[i][0] == starcoords[j][0]:
continent = starcoords[i][0]
continentcolour = clustercoords[continent][0]
c.create_line(xcor1, ycor1, xcor2, ycor2, fill=continentcolour,width=2, activefill='#900')
else:
c.create_line(xcor1, ycor1, xcor2, ycor2, fill="grey",width=2,activefill='#900')
for i in countries: #for whatever reason this part doesn't
(xcor1, ycor1) = starcoords[i][1]
print(xcor1,ycor1)
c.create_text(xcor1, ycor1,fill='grey')
as you can see, the first for-loop basically draws lines to each country it is connected to, and selects the color based on whether its part of the same continent. I'm not sure why c.create_line is working and c.create_text is not
for iloop is part of the function or part of something else (or part of the other for loop...)?