Hi,

I am trying to work with the python locale package and PyGTK but it doesn't seem to be so easy.

1- when getting a string for a gtk.Entry object :
value = locale.atof(textEntry.get_text())
the text "125,5" cannot be converted into a float even if my locale defines a "," as a decimal separator


2- when I force the locale to be e.g. "English", or "English_Canada", the decimal separator is "." (as given by locale.localeconv() ) but PyGTK is still using the comma as decimal separator (which is the default locale on my computer "French_Canada")

The result : my floats are displayed with a comma but I can only enter floats with a point as decimal separator. :-(

Here is the way I initialize my packages :
----
import locale
locale.setlocale(locale.LC_ALL, '')
import pygtk
pygtk.require('2.0')
import gtk
import re
-----
I am using Python on windows (Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32) with PyGTK 2.4.1


Do I use the locale package the wrong way ?

btw, do you know why on Windows the locale strings have to be named "English_Canada" rather than "en_CA" ?

Regards,

Stéphane



_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to