ttk.Treeview 小部件的 "tag add" 命令存在问题 - 无法处理白色 space
An issue with the "tag add" command of the ttk.Treeview widget - can't handle white space
我注意到在使用 tk.call()
方法激活时使用 ttk.Treeview
小部件的 tag add
命令会出现问题。也就是说,它无法在其 items
参数的 str()
元素的值中处理白色 space。
请参阅 ,了解我是如何实施标签添加命令的。现在如果 /home/user/Desktop/Secret Source
被传递给项目,返回的错误信息是:
self.tk.call(self.tree._w, 'tag', 'add', tag, items)
_tkinter.TclError: Item /home/user/Desktop/Secret not found
Secret Source
中缺少带有一个白色 space 的文本 Source
。我该如何克服这个错误?
treeview tag add
命令要求 items
是一个列表,但您传递的是一个字符串。当 tcl 在它需要一个列表时被赋予一个字符串,该字符串将在 whitespace 上被拆分以创建一个列表。这就是为什么它认为 space 之前的字符是整个项目 ID。
我注意到在使用 tk.call()
方法激活时使用 ttk.Treeview
小部件的 tag add
命令会出现问题。也就是说,它无法在其 items
参数的 str()
元素的值中处理白色 space。
请参阅 /home/user/Desktop/Secret Source
被传递给项目,返回的错误信息是:
self.tk.call(self.tree._w, 'tag', 'add', tag, items)
_tkinter.TclError: Item /home/user/Desktop/Secret not found
Secret Source
中缺少带有一个白色 space 的文本 Source
。我该如何克服这个错误?
treeview tag add
命令要求 items
是一个列表,但您传递的是一个字符串。当 tcl 在它需要一个列表时被赋予一个字符串,该字符串将在 whitespace 上被拆分以创建一个列表。这就是为什么它认为 space 之前的字符是整个项目 ID。