我正在制作一个需要一张TextInput
表的应用程序,我将在其中填充一些内容。完成后,我单击Store
Button
,然后以id
或coordinates
或任何可以让我区分{{1} }。我想避免在TextInputs
文件中手动创建每个TextInput
及其id
。下面的代码有可能吗?
.kv
答案 0 :(得分:1)
How about something like this:
def store(self):
for id, row in self._rows.items():
print(id)
col = 0
for ti in row().children:
print('\tcol #', col, ti.text)
col += 1
Just realized that the above code gets the column numbers reversed. This code gets it right:
def store(self):
for id, row in self._rows.items():
print(id)
children = row().children
col = len(children) - 1
for ti in children:
print('\tcol#', col, ti.text)
col -= 1