msg129097 - (view) |
Author: Clayton Darwin (claytondarwin) |
Date: 2011-02-22 17:05 |
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 |
|
|
msg129417 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2011-02-25 20:24 |
With 3.2, (Winxp) I get combobox with first line, input as r'C:\Python31\Lib\tkinter\test\test_ttk', displayed as "C:Python31Lib kinter est est_ttk" Something either deleted \ or converted \t to tab. Indeed, adding a space to the end of the string or enclosing as you specify inhibits deletion/conversion, so this seems like an error. With imports fixed from Tkinter import * import ttk the file runs fine in 2.7, so this seems 3.x specific problem. |
|
|
msg129422 - (view) |
Author: Clayton Darwin (claytondarwin) |
Date: 2011-02-25 20:39 |
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 |
|
|
msg130174 - (view) |
Author: Guilherme Polo (gpolo) *  |
Date: 2011-03-06 15:39 |
Does the attached patch work for you ? |
|
|
msg177349 - (view) |
Author: Jayden Kneller (PendulumDreams) |
Date: 2012-12-11 20:31 |
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. |
|
|
msg177351 - (view) |
Author: Jayden Kneller (PendulumDreams) |
Date: 2012-12-11 20:33 |
I should also add that I yellow highlighed where the space is in the image I attached so it easier to see. |
|
|
msg177353 - (view) |
Author: Jayden Kneller (PendulumDreams) |
Date: 2012-12-11 20:36 |
On a side note: If you pass raw string literals into the combo box as values this issue doesn't happen. |
|
|
msg177355 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2012-12-11 20:49 |
Issue15861 has a more general patch which fixes also this issue. |
|
|
msg180030 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2013-01-15 16:09 |
Fixed in . Thank you for report, Clayton Darwin. |
|
|