gpt4 book ai didi

tkinter - 从 tkinter 中的 TreeView 获取数据

转载 作者:行者123 更新时间:2023-12-04 02:07:04 27 4
gpt4 key购买 nike

我正在尝试从填充的 Treeview 中获取数据:

self.tree['show'] = 'headings'
self.tree['columns'] = ('Pool ID','Time', 'Lat', 'Lon', 'Alt', 'Spd', 'hdop','vdop','pdop', 'Sats Used', 'FixMode')
self.tree.column('Pool ID', width=90, anchor='center')
self.tree.heading('Pool ID', text='Pool ID')
self.tree.column('Time', width=90, anchor='center')
self.tree.heading('Time', text='Time')
self.tree.column('Lat', width=90, anchor='center')
self.tree.heading('Lat', text='Lat')
self.tree.column('Lon', width=90, anchor='center')
self.tree.heading('Lon', text='Lon')
self.tree.column('Alt', width=90, anchor='center')
self.tree.heading('Alt', text='Alt')
self.tree.column('Spd', width=90, anchor='center')
self.tree.heading('Spd', text='Spd')
self.tree.column('hdop', width=90, anchor='center')
self.tree.heading('hdop', text='hdop')
self.tree.column('vdop', width=90, anchor='center')
self.tree.heading('vdop', text='vdop')
self.tree.column('pdop', width=90, anchor='center')
self.tree.heading('pdop', text='pdop')
self.tree.column('Sats Used', width=90, anchor='center')
self.tree.heading('Sats Used', text='Sats Used')
self.tree.column('FixMode', width=90, anchor='center')
self.tree.heading('FixMode', text='FixMode')

for i in range(5):

self.tree.insert('', -1, values=(
i+1,
i+2,
i+3,
i+4,
i+5,
i+6,
i+7,
i+8,
i+9,
i+10,
i+11))

我在文档和 SO 上进行了搜索,但没有找到任何相关信息。有人可以帮我吗?

最佳答案

好的,我终于找到了方法,例如显示所有值:

for line in self.tree.get_children():

for value in self.tree.item(line)['values']:
print(value)

关于tkinter - 从 tkinter 中的 TreeView 获取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23829409/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com