Issue 1222721: tk + setlocale problems... (original) (raw)

Created on 2005-06-17 15:23 by alex_nanou, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
bug.py alex_nanou,2005-06-17 15:23 code demonstrating the error...
tksetlocalebug.py ghorvath,2008-03-26 16:51 Workaround for orginal bug.py
nobug.py terry.reedy,2010-06-25 22:33 Running 3.1 version of bug.py
Messages (7)
msg25562 - (view) Author: Alex A. Naanou (alex_nanou) Date: 2005-06-17 15:23
Description: when using both the tkinter GUI and the locale.setlocale (locale.LC_ALL, '') call on Py2.4, the following error is printed to stderr:
error reading package index  file /usr/share/tcl/vfs1.3/pkgIndex.tcl: syntax error in expression "[package provide Tcl] < 8.4":  extra tokens at end of expression 
in addition to this, the BackSpace key appears not to be handled by the tk input widgets (for example "Entry") after the setlocale call. in Py2.4.1 the error is no longer printed, though the problem with the BS key persists. Testcase: see attached file. --- Originally posted to ALTLinux bugtracker (original text (Russian): https://bugzilla.altlinux.org/show_bug.cgi? id=6339) --- additionally tested on: Py2.4.1 (builds for win32, cygwin, debian linux)
msg64560 - (view) Author: ghorvath (ghorvath) Date: 2008-03-26 14:55
I can confirm that this bug is still present. After locale.setlocale(locale.LC_ALL, '') Backspace in Tkinter.Entry is not working anymore. There is no difference if the Backspace is issued by the keyboard or by self.master.winfo_toplevel().event_generate('') No messages are written. Tested on Linux (Ubuntu Gutsy)/Python 2.5.1 and Windows XP/Python 2.4.3
msg64562 - (view) Author: ghorvath (ghorvath) Date: 2008-03-26 16:51
Attached a workaround for this problem, based on: http://ml.osdir.com/games.mud.client.lyntin/2005-03/msg00005.html I also found that the problem only appears when the LC_NUMERIC setting is different to en_US. (for example if it is de_AT)
msg79345 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2009-01-07 15:59
The problem with the backspace key was fixed in python 2.6 when using the windows installer at least. I didn't check yet if it is specific to tcl/tk or if it involves tkinter.
msg108640 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-06-25 22:33
The backspace issue seems to have been fixed. I modified bug.py for 3.1 by removing the coding cookie, changing unicode("Ïðîáà", "KOI8-R") to just "Ïðîáà", and fixing print. Running from IDLE, it ran and displayed a tk window with text entry and labelled button that printed "Friday" in the shell window. On the other hand, "I also found that the problem only appears when the LC_NUMERIC setting is different to en_US. (for example if it is de_AT)" suggests that other might have a problem (I am in the US). Sidenote: Since the obscure koi8-R encoding (no longer valid in 3.x, the interpreter said) is not described as part of the bug, it should not be part of a minimal example.
msg156606 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2012-03-22 19:04
I have no problems with executing demo. I used Russian locale with LC_NUMERIC, utf-8 and cp1251 (Russian Windows encoding). Looks like the problem cannot be reproduced.
msg156622 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2012-03-22 21:18
Thanks for retesting. Closing until there is a clear problem with current releases.
History
Date User Action Args
2022-04-11 14:56:11 admin set github: 42094
2012-03-22 21🔞40 terry.reedy set status: open -> closedresolution: out of datemessages: + versions: - Python 2.4
2012-03-22 19:04:48 asvetlov set nosy: + asvetlovmessages: +
2010-06-25 22:33:19 terry.reedy set files: + nobug.pyversions: + Python 2.7, - Python 2.5nosy: + terry.reedymessages: +
2009-01-07 15:59:37 gpolo set messages: +
2008-09-15 17:31:12 gpolo set nosy: + gpolo
2008-03-26 16:51:41 ghorvath set files: + tksetlocalebug.pymessages: +
2008-03-26 14:55:42 ghorvath set nosy: + ghorvathmessages: + versions: + Python 2.5
2005-06-17 15:23:54 alex_nanou create