from tkinter import * master= Tk() fm=open("linnad.txt","r") linnad=[] for linn in fm: linn=linn.strip().split() linnad.append(linn) fm.close() paarid=[] fm=open("linnadyhendused.txt","r") for paar in fm: paar=paar.strip().split() paarid.append(paar) w = Canvas(master, width=1038, height=697) w.pack() #map_1=PhotoImage(file="eesti-kaart.gif") #w.create_image(0,0,image=map_1,anchor=NW) for s in range(len(paarid)): for t in range(10): if paarid[s][0]==linnad[t][0]: x1= int(linnad[t][1]) y1=int(linnad[t][2]) if paarid[s][1]==linnad[t][0]: x2= int(linnad[t][1]) y2=int(linnad[t][2]) w.create_line(x1,y1,x2,y2, width=5,fill="pink") for i in range(10): w.create_text(linnad[i][1],linnad[i][2], text=linnad[i][0], font="16", fill="blue") mainloop()