I'm studying python lately, and now I'm working on tkinter and firebase. I was making a timeline viewer that can be changed from a manager.
As I was making, I had to make a table of labels that is 5*7 size. At first, I tried to make it like: label12 = Label(...
But I thought that I could make it into list: label[1][2] = Label(...)
I tested it on other code, and the first dimension list worked well, with the configuration working. I could change the text of the label with: label[1].config(text="test)
but, when I used it on the second dimension list, it gave me an error:
AttributeError: 'int' object has no attribute 'config'
This is a part of my code where the error occured. when I changed the text from daylabel using config, it worked well.
def RegistClicked():
day = \['Mon', 'Tue', 'Wed', 'Thu', 'Fri'\]
dayarray = ["월요일", "화요일", "수요일", "목요일", "금요일"]
daylabel = [0 for i in range(5)]
numlabel = [0 for i in range(8)]
classnumlabel = [[0 for i in range(6)] for j in range(8)]
for i in range(0, 5):
daylabel[i] = Label(win, width=10, height=2, text=dayarray[i])
daylabel[i].grid(row=4, column=i+2)
for i in range(0, 7):
numlabel[i] = Label(win, width=10, height=2, text=i+1)
numlabel[i].grid(row=i+5, column=1)
for i in range(1, 8):
for j in range(1, 6):
classnumlabel[i][j] = Label(win, width=10, text="value")
classnumlabel[i][j].grid(row=i+4, column=j+1)
global selectclass
selectclass = strvar.get()
classlabel.config(text=selectclass)
for i in range(5):
for j in range(1, 8):
dir = db.reference(selectclass +'/'+ day[i] +'/'+ 'class' + str(j))
print(selectclass +'/'+ day[i] +'/'+ 'class' + str(j))
classnumlabel[j][i].config(text=dir.get())
Everything was well until I hit the refresh button, which triggers the function above, would kill the program with the error saying that the dayclasslabel array is an 'int' object.
