I have an csv file that is read into my program and displays information in the GUI. in addition to that I have a Map in GIF format which i want to display alongside the information from the file. The last column in my file is called location and i want to link those images to these files. please help
with open("PN_Database.csv", "r") as csvfile:
Data_File = csv.DictReader(csvfile, delimiter = ",")
for row in Data_File:
if row['Part Number'] == pntext.upper():
PartInfoString.set(row['Part Number']+ "\n"
+ row['Prod Desc 1']+ "\n"
+ row['Prod Desc 2']+ "\n"
+ row['Prod Desc 3']+ "\n"
+ row['Prod Desc 4']+ "\n"
+ "Quantity: " + row['Quantity']+ "\n"
+ "Price :" + row['Price']+ "\n"
+ "Re-Order Level :" + row['ReOrder Levels']+ "\n"
+ "Location :" + row['Warehouse Location'])
csvfile.close()
if "Location :" in Data_File == "A1":
photo = PhotoImage(file="image_3.gif")
photoLabel = Label(image=photo)
photoLabel.image = photo
photoLabel.grid(row = 4, column = 3, columnspan = 2)
elif "Location :" in Data_File == "A2":
photo = PhotoImage(file="image_4.gif")
photoLabel = Label(image=photo)
photoLabel.image = photo
photoLabel.grid(row = 4, column = 3, columnspan = 2)
elif "Location :" in Data_File == "B1":
photo = PhotoImage(file="image_5.gif")
photoLabel = Label(image=photo)
photoLabel.image = photo
photoLabel.grid(row = 4, column = 3, columnspan = 2)
elif "Location :" in Data_File == "B2":
photo = PhotoImage(file="image_6.gif")
photoLabel = Label(image=photo)
photoLabel.image = photo
photoLabel.grid(row = 4, column = 3, columnspan = 2)
the location columns are - A1,A2,B1,B2,B3,B4,B5,C1,D1,D2,D3,D4,D5.
the problem with this that it doesnt display the images in the if loop
Aucun commentaire:
Enregistrer un commentaire