Skip to content Skip to sidebar Skip to footer

Ttk Treeview Selection_set Can't Accept Spaces

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 selection when my program starts bu

Solution 1:

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 is '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. ;)

Solution 2:

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

Post a Comment for "Ttk Treeview Selection_set Can't Accept Spaces"