[PyQt] Decimal separator Problem

Linos info at linos.es
Tue Nov 13 22:43:29 GMT 2007

Ok, the real problem here it is that i cant use the dot in the numpad to begin decimal numbers, i have checked
and spanish locale use comma like decimal separator, i was confused by too many english software i use, but i
have checked and in almost all the software i can use the dot in numpad to begin decimal numbers (although i
view a comma), anyone knows how to map the symbol or other way to do that?

Linos escribió:
> Hello,
> 	i have a problem with the decimal separator in float numbers, i detect the problem in a QDoubleSpinBox (the
> decimal separator should be "." but it is ",") and i think it is failing in other objects. My locale in
> "es_ES", if i use "locale" command in bash i get this:
> LANG=es_ES
> LC_CTYPE="es_ES"
> LC_TIME="es_ES"
> LC_PAPER="es_ES"
> LC_NAME="es_ES"
> LC_ALL=es_ES
> i have added this code to the __init__ of a dialog.
> print QString("%L1").arg(10.54)
> locale = QLocale()
> country = locale.country()
> language = locale.language()
> print locale.countryToString(country)
> print locale.languageToString(language)
> print QString("10,25").toDouble()[0]
> and i get this output:
> 10,54
> Spain
> Spanish
> 10.25
> The first localized arg isnt good and the last toDouble it is good printed because python convert it to a
> float and python dont have the problem with the locale. The strange about this it is i have the same problem
> if i exec in a windows machine, what can be the problem?
> Best Regards,
> Miguel Angel.
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

More information about the PyQt mailing list