This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年02月22日 17:05 by claytondarwin, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| tcl_string_test.py | claytondarwin, 2011年02月22日 17:05 | Illustrates ttk.Combobox['values'] string error. | ||
| patch11290.diff | gpolo, 2011年03月06日 15:39 | |||
| tested_patch.png | PendulumDreams, 2012年12月11日 20:31 | Image of 2 combo boxes. Top with no patch, bottom with patch applied. | ||
| Messages (9) | |||
|---|---|---|---|
| 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) * (Python committer) | 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) * (Python committer) | 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) * (Python committer) | Date: 2012年12月11日 20:49 | |
Issue15861 has a more general patch which fixes also this issue. |
|||
| msg180030 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年01月15日 16:09 | |
Fixed in issue15861. Thank you for report, Clayton Darwin. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:13 | admin | set | github: 55499 |
| 2013年01月15日 16:09:07 | serhiy.storchaka | set | status: open -> closed resolution: fixed messages: + msg180030 stage: resolved |
| 2012年12月12日 09:46:01 | serhiy.storchaka | set | superseder: ttk.Treeview "unmatched open brace in list" versions: + Python 2.7, Python 3.2, Python 3.4 |
| 2012年12月11日 20:49:27 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg177355 |
| 2012年12月11日 20:36:24 | PendulumDreams | set | messages: + msg177353 |
| 2012年12月11日 20:33:14 | PendulumDreams | set | messages: + msg177351 |
| 2012年12月11日 20:31:17 | PendulumDreams | set | files:
+ tested_patch.png versions: - Python 3.1, Python 3.2 nosy: + PendulumDreams messages: + msg177349 |
| 2011年03月06日 15:39:22 | gpolo | set | files:
+ patch11290.diff messages: + msg130174 keywords: + patch nosy: terry.reedy, gpolo, claytondarwin |
| 2011年02月25日 20:39:52 | claytondarwin | set | nosy:
terry.reedy, gpolo, claytondarwin messages: + msg129422 |
| 2011年02月25日 20:24:55 | terry.reedy | set | nosy:
+ gpolo, terry.reedy messages: + msg129417 versions: + Python 3.2, Python 3.3 |
| 2011年02月22日 17:05:20 | claytondarwin | create | |