The code I have attached below functions like this: It takes users ID and marks. It goes through an excel sheet and finds that specific ID. Then it will update the second column in that row with his marks. However, this code gives me an error when I run it. The error comes from .get() function used for getting value of an Entry. I have used .get() function in other projects where it works.
import xlwt
import xlrd
from xlutils.copy import copy
from tkinter import *
root = Tk()
root.title("Quiz marks uploader")
root.geometry("500x500")
rnn = "global"
maar = "global"
def upload():
rn = entry_1.get()
mar = entry_2.get()
rnn = rn
maar = mar
button_1 = Button(root, text = "Upload", command = upload).place(relx = 0.3,rely = 0.2,anchor = NE)
label_1 = Label(root, text = "Enter Reg No here").place(relx = 0.2,rely = 0.05,anchor = E)
entry_1 = Entry(root).place(relx = 0.5,rely = 0.05,anchor = E)
label_2 = Label(root, text = "Enter marks here").place(relx = 0.2,rely = 0.1,anchor = E)
entry_2 = Entry(root).place(relx = 0.5,rely = 0.1,anchor = E)
workbook = xlrd.open_workbook("file.xls")
sheet = workbook.sheet_by_index(0)
rb = xlrd.open_workbook("file.xls")
wb = copy(rb)
w_sheet = wb.get_sheet(0)
for row in range(sheet.nrows):
row_value = sheet.row_values(row)
if row_value[0] == rnn:
w_sheet.write(row,1,maar)
print (row_value)
wb.save("file.xls")
root.mainloop()