New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ttk.Combobox['values'] String Conversion to Tcl #55499
Comments
In working with the ttk.Combobox (Windows XP, Python 3.1), I have found that setting the values for the popdown using ttk.Combobox['values'] has an problem converting the string to the proper Tcl value when (and this is the only instance I have found) there is a backslash in the string but no spaces. In this case, the string will translate if it is enclosed in curly brackets '{'+mystring+'}', which I believe is the Tcl syntax to not make substitutions. I have attached a short script that illustrates this issue. Clayton |
With 3.2, (Winxp) I get combobox with first line, With imports fixed |
This is a simple work around. def fix_tcl_error(s):
if '\\' in s and not ' ' in s:
s = '{'+s+'}'
return s You can get the text from the Combobox with no issues. The error is in posting it to the Combobox when you have backslashes and no spaces (I think). I have just been running everything through this def before adding it. It has worked with no problems so far using Windows paths and grep-type search strings. CD |
Does the attached patch work for you ? |
I also ran into this issue in python 3.3 64bit on windows 7. I was adding paths into a combo box and was escaping all \'s myself. When I created a folder with a space I noticed the paths with the space had double the \'s I wanted. I removed my escaping and tested the patch and the attached image shows that it works. The top of the image was before, the bottom of the image was after. |
I should also add that I yellow highlighed where the space is in the image I attached so it easier to see. |
On a side note: If you pass raw string literals into the combo box as values this issue doesn't happen. |
bpo-15861 has a more general patch which fixes also this issue. |
Fixed in bpo-15861. Thank you for report, Clayton Darwin. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: