ttk Treeview selection_set can't accept spaces

后端 未结 2 1851
不知归路
不知归路 2020-12-21 04:44

I\'m building a gui using tkk in python and I\'m having trouble with the Treeview command selection_set(). I\'m trying to use it to set the default

相关标签:
2条回答
  • 2020-12-21 05:10

    You might try the following:

    tree.selection_set('"Sunset Grill"')
    

    I'm guessing this based on the code for ttk.py and my limited understanding of Tcl. The call to tree.selection_set() calls self.selection("set", items), which in turn calls self.tk.call(self._w, "selection", selop, items) where selop='set' and items is the string initially passed to selection_set(). I'm not sure if the self.tk.call() is doing any massaging of the arguments before passing them to Tcl as it's a call into the _tkinter.c module and I don't know enough about the Python/C interface to grok that code. ;)

    0 讨论(0)
  • 2020-12-21 05:13

    try tree.selection_set(["Sunset Grill"])

    0 讨论(0)
提交回复
热议问题