单击空白区域后清除选择
我目前正在使用 python 3.9 并尝试在单击空白区域后清除选择
它看起来像这个。
这是我的代码:
fileTreeView = ttk.Treeview(m, name='fileTreeView')
fileTreeView['columns']=('name', 'datem', 'type', 'size', 'blankspace')
fileTreeView.column('#0', width=0, stretch=NO)
fileTreeView.column('name', width=60)
fileTreeView.column('datem', width=60)
fileTreeView.column('type', width=60)
fileTreeView.column('size', width=60)
fileTreeView.column('blankspace', width=60)
fileTreeView.heading('#0')
fileTreeView.heading('name', text='Name')
fileTreeView.heading('datem', text='Date modified')
fileTreeView.heading('type', text='Type')
fileTreeView.heading('size', text='Size')
fileTreeView.heading('blankspace', text="")
我希望当单击空白列时,它将清除选择。
提前致谢!
I'm currently using python 3.9 and trying to clear the selection after clicking to a blank space
It looks something like this.
This is my code:
fileTreeView = ttk.Treeview(m, name='fileTreeView')
fileTreeView['columns']=('name', 'datem', 'type', 'size', 'blankspace')
fileTreeView.column('#0', width=0, stretch=NO)
fileTreeView.column('name', width=60)
fileTreeView.column('datem', width=60)
fileTreeView.column('type', width=60)
fileTreeView.column('size', width=60)
fileTreeView.column('blankspace', width=60)
fileTreeView.heading('#0')
fileTreeView.heading('name', text='Name')
fileTreeView.heading('datem', text='Date modified')
fileTreeView.heading('type', text='Type')
fileTreeView.heading('size', text='Size')
fileTreeView.heading('blankspace', text="")
I want when the blankspace column is clicked, it will clear the selection.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在
< button-1>
事件的回调中找到单击的列,如果是blankSpace
,则清除选择:You can find the column being clicked inside the callback of
<Button-1>
event, if it isblankspace
then clear the selection: