Kivy中的TextInput表。如何访问每个TextInputs

时间:2019-04-08 12:29:32

标签: python kivy

我正在制作一个需要一张TextInput表的应用程序,我将在其中填充一些内容。完成后,我单击Store Button,然后以idcoordinates或任何可以让我区分{{1} }。我想避免在TextInputs文件中手动创建每个TextInput及其id。下面的代码有可能吗?

.kv

1 个答案:

答案 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