此应用程序是每个任务的秒表。 我按循环为每个任务创建了标签和按钮,但现在的问题是所有按钮都引用了最后一个标签。我怎样才能解决它
这是它现在的样子:
这里是我的秒表功能和动态变化的标签。但是,当它需要更改与单击按钮位于同一行的标签时,它将返回到最后一个
def update_timeText():
# We create our time string here
timeString = pattern.format(timer[0], timer[1], timer[2])
# Update the timeText Label box with the current time
这个代码线地址是最后一个
labels[i].configure(text=timeString)
# Call the update_timeText() function after 1 second
root.after(1000, update_timeText)
# Simple status flag
state = False
#data from google table(only first 3 rows)
global i
for j in range(3): #Columns
for (i,cell) in enumerate(list_cells):
i=i+1
list_rows = cell.row
values_list = sheet.row_values(list_rows)
project = Label(root, text=values_list[j])
items.append(project)
project.grid(row=i, column=j)
value=len(list_cells)
for i in range(value):
labels.append(Label(root,text="00:00:00"))
labels[i].place(x=800,y=10+(30*i))
Button(root,text="Start", command = start).place(x=870,y=10+(30*i))
Button(root,text="Accept", command = pause).place(x=910,y=10+(30*i))
rows.append(items)
#run
update_timeText()
mainloop()
我知道你的台词
及
它们相互矛盾
相关问题 更多 >
编程相关推荐