[pygtk] Reacting to SpinButton input, or how does SpinButton parse text?
Bertrand Son Kintanar
b3rxkintanar at gmail.com
Tue Dec 23 06:19:25 WST 2008
On Wed, Dec 17, 2008 at 1:38 AM, Joel Hedlund <yohell at ifm.liu.se> wrote:
>
> ...
>
> Using float(b.get_text()) does not work, because the text is
> internationallized and may have decimal commas and other weird things
> that python does not like. Using locale.atof(b.get_text()) does not work
> either, because in the en_US locale the string "0,11" is interpreted by
> the SpinButton as 0 and by locale.atof as 11. For integers it's no
> easier, because "50,1,,1" is interpreted by the SpinButton as 50 and by
> locale.atof as 5011.
>
> ...
>
Have you tried using the get_value() function of gtk.SpinButton() ? Usually
that is how I retrieve the value of it. I haven't tried it with using
locales though so there might be some other way.
--
b3rx
"Don't be trapped by dogma - which is living with the results of other
people's thinking. - Steve Jobs"
`There are only 10 types of people in the world — those who understand
binary, and those who don't.'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20081223/b6f6432e/attachment.htm
More information about the pygtk
mailing list