Python Tkinter csv read file to Entry
You can't set the text of an Entry field in the same way that you would for a Label. You need to use the insert method of an entry widget as shown below
def panel_admin(): admingui.destroy() adminpanel = Toplevel() with open("Staff Bookings.csv", newline = "") as file: reader = csv.reader(file) r = 0 for col in reader: c = 0 for row in col: curEntry = Entry(adminpanel, width = 10, relief = RIDGE) curEntry.grid(row = r, column = c) curEntry.insert(0, row) c += 1 r += 1
Note that if you want to write out the edited entry fields, you should probably store the curEntry
in a list or dictionary for you to access later. For example you could keep the row,col number as a dictionary key and the Entry widget as the values using something like the code below
fields[(r,c)] = curEntry