Sep-03-2021, 05:08 PM
I am making a program using python and tkinter which basically is an expense tracking system. However, I am getting an error when running my program which has to do with the code shown below. It is raising an error, mentioning that the 'list index is out of range.'
It confuses me that I am getting this error because the for loop (in this case) runs only once and the index seems to be within range as the value of 'i' is 1 and the list that it is iterating through is as follows: [('admin', '999'), ('Cheese', 'incorrect')] Would anyone please be able to explain why I am getting this error...
It confuses me that I am getting this error because the for loop (in this case) runs only once and the index seems to be within range as the value of 'i' is 1 and the list that it is iterating through is as follows: [('admin', '999'), ('Cheese', 'incorrect')] Would anyone please be able to explain why I am getting this error...
for i in range(1, len(self.l_credentials)): print(i) print(self.l_credentials) self.my_users.add_command(label="{}".format(self.l_credentials[i][0]), command=lambda: self.callback(self.l_credentials[i][0])) self.my_users.add_separator()