Bryan Oakley added the comment: I gave myself an hour or so to play around with this, and the crux of the matter seems to be in the function `_format_optdict()` which converts a dictionary of options and values into something suitable to pass to `tk.call()`. However, I think the same bug is in other `_format*` functions as well, it's just that their nature is such that they have much less of a chance to be passed weird data.
`_format_optdict` has some code that does a half-hearted attempt at handling values that are tuples, such as the case with the "values" attribute of the ttk.Treeview widget. However, all it does is protect values that have a space, by surrounding the value with curly braces. Hence, when the value itself has a curly brace, tcl throws the "unmatched open brace" error. What is needed is to create a bona fide tcl list element according to the rules of Tcl. I tried a hack where I simply escaped all problem characters, so instead of returning `{foo bar}` the function returns `foo\ bar`. This seemed to work, at least for the tiny bit of testing that I did. Another solution might be to do something like tk.call("list",*the_tuple), though sadly, `_format_optdict` is a function rather than a method so it doesn't have access to the tcl interpreter. What I think ttk needs (and may already exist somewhere in the Tkinter world; I haven't looked...) is a function that takes a tuple and converts it to a canonical list. Then, the places that do something ad hoc can all call this one function. For more information on the gory details of the string representation of a list see http://www.tcl.tk/cgi-bin/tct/tip/407.html ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15861> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com