homepage

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.

classification
Title: scrollbar crash in non-US locale format settings
Type: behavior Stage:
Components: Tkinter Versions: Python 3.1
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: brian.curtin, hans.bering, hfischer, r.david.murray, terry.reedy, tim.golden
Priority: normal Keywords:

Created on 2010年12月07日 20:55 by hfischer, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ListboxScrollbarLocaleIssue.py hfischer, 2010年12月07日 23:03 minimal test program demonstrating problem
scrollbarCrash1.py hans.bering, 2011年07月07日 12:04 locale-dependent Scrollbar crash
Messages (9)
msg123580 - (view) Author: Herm Fischer (hfischer) Date: 2010年12月07日 20:55
My app has a tkinter messages listbox with a scrollbar which works fine in US setting, but not when locale is a European setting (with comma for decimal point). It's a highly interactive app with a lot of number formattings in the local locale, and mostly used in Europe and Asia.
This instruction: self.logListBox.insert(END, message)
causes this crash in non-US locale when scrolling down:
Class: class Scrollbar(Widget):
 def set(self, *args):
 """Set the fractional values of the slider position (upper and
 lower ends as value between 0 and 1)."""
 self.tk.call((self._w, 'set') + args) <<<<===== this line causes exception in European settings
the arg is in European decimal point format, when run on European settings, the error trace is:
 File "C:\Python31\lib\tkinter\__init__.py", line 1399, in __call__
 return self.func(*args)
 File "C:\Python31\lib\tkinter\__init__.py", line 2797, in set
 self.tk.call((self._w, 'set') + args)
_tkinter.TclError: expected floating-point number but got "0,145833"
using python 3.1.3 (r313:86834)
msg123581 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010年12月07日 21:55
I'm not sure what bug you are reporting here. Are you saying that values using a , are automatically getting generated by tkinter and then rejected when fed back in? If so, I suspect this is a tk problem, not tkinter problem, but someone would have to produce an equivalent tk/tcl program to prove it one way or another. Can you produce a minimal test program that demonstrates the problem? What version of tk/tcl are you using?
msg123585 - (view) Author: Herm Fischer (hfischer) Date: 2010年12月07日 23:03
The attached test case demonstrates this issue, run on pthyon 3.1.3 x64 and included tkinter.
When running on US Locale, runs fine. Numbers have the period decimal point, no exceptions raised.
Then select control panel, "Language or Region", "Change keyboards and input methods", Formats tab, and I selected Dutch(Netherlands), press ok. Rerun. (I'm running under Eclipse, so exceptions do not terminate the program). Note these exceptions as listbox is filled and autoscrolls, and as well, if you manually scroll, same exceptions get raised:
 File "C:\Python31\lib\tkinter\__init__.py", line 1399, in __call__
 return self.func(*args)
 File "C:\Python31\lib\tkinter\__init__.py", line 2797, in set
 self.tk.call((self._w, 'set') + args)
_tkinter.TclError: expected floating-point number but got "0,02"
msg123586 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010年12月07日 23:34
On gentoo linux with tcl/tk 8.5.8, if I use the following command line:
>LC_NUMERIC=fr_FR ../release31-maint/python ListboxScrollbarLocaleIssue.py
(which runs 3.1.3+) I can move the slider without any problem. I confirmed that locale.format_string("%f", 0.30) produces 0,300000 after doing a setlocale at the python interactive prompt. (I used fr_FR because I happen to have that locale installed, and I don't have Dutch installed).
So, so far I can't reproduce your problem. I don't use eclipse, so eclipse related reproduction instructions won't work for me.
Note that when you say "exceptions don't terminate the program" I am assuming you mean it doesn't terminate eclipse. You'd need to be starting python itself fresh to produce a valid test run.
What version of tk/tcl is your python compiled against?
msg123587 - (view) Author: Herm Fischer (hfischer) Date: 2010年12月08日 00:07
I'm using the 3.1.3 x64 of python.org
The dll's that came with it:
tck85.dll, version 8.5.2.2, created 8/10/2010
tk85.dll, version 8.5.2.2, same date
Is there a different way to get the version that is more helpful?
Is there an easy way to try the tcl/tk you are using (and distribute it to my users)?
msg123590 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010年12月08日 02:08
Well, it sounds like you are on Windows, which is a platform I'm not all that familiar with. I think we bundle TK for the windows installer, but I'm not 100% sure. I think to use a different version you have to recompile Python, which on Windows is a non-trivial undertaking (but entirely possible). I'm adding a couple of windows people to nosy, perhaps they will have some thoughts.
msg139972 - (view) Author: Hans Bering (hans.bering) Date: 2011年07月07日 12:04
Ok, _now_ I have run into the same problem. I have attached a small script similar to the original entry (but shorter) which will reliably crash with Python 3.1.4 on Windows 7 (64bit) when using a locale with a comma decimal fraction marker (e.g., German). The stacktrace is as follows:
Exception in Tkinter callback
Traceback (most recent call last):
 File "C:\Python31\lib\tkinter\__init__.py", line 1400, in __call__
 return self.func(*args)
 File "C:\Python31\lib\tkinter\__init__.py", line 2799, in set
 self.tk.call((self._w, 'set') + args)
_tkinter.TclError: expected floating-point number but got "0,2"
The script runs fine with an English locale. It also runs fine with Python 3.2 on the same machine & Windows & German locale.
The reason seems to be that the Scrollbar lets its self.tk compute fractions which self.tk returns as locale-dependent strings; the Scrollbar runs into problems when converting these strings into floats.
msg140370 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011年07月14日 19:49
Two messages deleted at Hans' request since he opened #12558
Hans says there that he could not reproduce *this* issue with 3.2.
Herm, please retry with 3.2 as 3.1.4 is last bugfix for 3.1 series.
If this works on 3.2, this should be closed.
msg140372 - (view) Author: Herm Fischer (hfischer) Date: 2011年07月14日 20:22
Yes, I can confirmm that this issue is gone on 3.2. Closed.
History
Date User Action Args
2022年04月11日 14:57:09adminsetgithub: 54856
2011年07月14日 20:22:00hfischersetstatus: open -> closed

messages: + msg140372
2011年07月14日 19:49:17terry.reedysetnosy: + terry.reedy
messages: + msg140370
2011年07月14日 19:48:40terry.reedysetmessages: - msg139876
2011年07月14日 19:48:30terry.reedysetmessages: - msg139566
2011年07月14日 15:26:32r.david.murrayunlinkissue12558 superseder
2011年07月14日 15:25:16r.david.murraylinkissue12558 superseder
2011年07月07日 12:04:21hans.beringsetfiles: - tkinterCrash.py
2011年07月07日 12:04:12hans.beringsetfiles: + scrollbarCrash1.py

messages: + msg139972
2011年07月05日 14:47:38hans.beringsetmessages: + msg139876
2011年07月01日 10:46:42hans.beringsetfiles: + tkinterCrash.py
nosy: + hans.bering
messages: + msg139566

2010年12月08日 02:08:43r.david.murraysetnosy: + tim.golden, brian.curtin
messages: + msg123590
2010年12月08日 00:07:10hfischersetmessages: + msg123587
2010年12月07日 23:34:19r.david.murraysetmessages: + msg123586
2010年12月07日 23:03:38hfischersetfiles: + ListboxScrollbarLocaleIssue.py

messages: + msg123585
2010年12月07日 21:55:05r.david.murraysetnosy: + r.david.murray
messages: + msg123581
2010年12月07日 21:11:17brian.curtinsettype: crash -> behavior
2010年12月07日 20:55:33hfischercreate

AltStyle によって変換されたページ (->オリジナル) /