将 treeview table 放入新数据框的方法

Method to get treeview table into new dataframe

我在重新进入树视图的新数据框时遇到了一些问题 table。

到目前为止,我所做的是将我的数据框显示到树视图中 table 并修改单元格。问题是我需要将这个 table 与新数据框中的更改一起取回。我正在寻找类似这样的东西,但要寻找树视图:

for i in range(nb_group):
      label = Label(window1, text='Name group {} : '.format(i+1)).grid(row=i)
      entry = Entry(window1)
      entry.grid(row=i, column=1)
      entries.append(entry)

list_groups = []
   for entry in entries:
       list_groups.append(entry.get())
        window1.destroy()

这是关于我的树视图的一些代码table

tree.pack(side='top')
b = Button(frame, text='Button1', command=confirmation, padx=20)
b.pack(pady=20, padx=20)
for i in range(counter):
            tree.insert('', i, text=rowLabels[i], values=df_verification_grid_2.iloc[i, :].tolist())
tree.bind('<1>', edit)

我的预期结果是我的树视图 table 及其新值的数据框。 提前致谢

要获取 treeview 项的信息,您可以使用 tree.item(iid)

如果您需要检索 treeview 小部件中所有子项的值,您可以遍历 tree.get_children:

的结果
values = []
for child in tree.get_children():
    values.append(tree.item(child)["values"])

或者使用列表理解:

values = [tree.item(child)["values"] for child in tree.get_children()]