如何取消选择 tkinter 中 ttk.Treeview 中的行 [英] how to UNSELECT row in a ttk.Treeview in tkinter

查看:52
本文介绍了如何取消选择 tkinter 中 ttk.Treeview 中的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一旦我点击 ttk.Treeview() 并选择一行,我就可以点击另一行,但我无法UNSELECT所有行,将始终至少选择 1 行.有没有聪明的方法可以取消选择最后选择的行?

Once I click into a ttk.Treeview() and select a row, I can click another row but there is no way for me to UNSELECT all the rows, there will always be at least 1 row selected. is there a clever way to allow unselecting the last selected row?

推荐答案

更改你的变量的名称我使用 treeview=ttk.Treeview() 并放入一个按钮 [UNSELECT ALL] 如下代码:

Change the name of your var i use treeview=ttk.Treeview() and put in a button [UNSELECT ALL] the following code:

treeview.selection_clear()

这篇关于如何取消选择 tkinter 中 ttk.Treeview 中的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆