def directselection(event=None):
# get all row IDs
idlist = treeviewtable.get_children()
if idlist:
# select and focus on first row
treeviewtable.selection_set(idlist[0])
treeviewtable.focus(idlist[0])
# transfer keyboard focus to treeviewtable
treeviewtable.focus_force()
使用
.get_children()
获取行ID列表,然后使用.selection_set()
选择第一行:相关问题 更多 >
编程相关推荐