wx.SpinCtrl for Floats?

Hello Rich,

My reading and testing confirms that a wx.SpinCtrl will work only with
interger numbers. I have an input variable that can vary from 0.00-1.00 by
hundredths. Is there a widget that will scroll through the values from

0.00,

0.01, 0.02, etc. to 1.00? Or, is my only option to have the user enter it
manually?

What about FloatSpin:

http://xoomer.virgilio.it/infinity77/eng/freeware.html#floatspin

?

I have written it about 1 month ago, it should do the job for your request.

Andrea.

···

_______________________________________________
Andrea Gavana
Reservoir Engineer
MOGI ? Reservoir Characterization and Modeling Dept.
ENI S.p.A. ? Exploration & Production Division
Via Emilia, 1 ? 20097 San Donato Milanese (MI) ? Italy
Phone: +39 02 520 62972
Fax: +39 02 520 61824
E-mail: andrea.gavana@agip.it
Restyled Internet Site: http://xoomer.virgilio.it/infinity77/
____________________________________________________

Eni S.p.A.
Sede legale in Roma,
Piazzale Enrico Mattei 1, 00144 Roma
Tel. centralino: +39 06598.21
www.eni.it
Capitale sociale € 4.002.934.326 i.v.
Registro Imprese di Roma,
Codice Fiscale 00484960588
Part. IVA 00905811006
R.E.A. Roma n. 756453

Andrea,

   Wow! What will I need next month? :slight_smile:

   Many thanks. This is just what is needed.

Rich

···

On Tue, 6 Dec 2005, andrea.gavana@agip.it wrote:

What about FloatSpin:

http://xoomer.virgilio.it/infinity77/eng/freeware.html#floatspin

I have written it about 1 month ago, it should do the job for your request.

--
Richard B. Shepard, Ph.D. | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

Andrea,

   Super kewel! Two issues to report:

   1) When I add 'extrastyle=FS_LEFT' python complains about no global
variable called 'FS_LEFT'.

   2) I define 'initial=0.20' but the low value (0.00) is displayed instead.

   It's certainly a great widget and I applaud your efforts and thank you.

Rich

···

On Tue, 6 Dec 2005, andrea.gavana@agip.it wrote:

What about FloatSpin:
http://xoomer.virgilio.it/infinity77/eng/freeware.html#floatspin

--
Richard B. Shepard, Ph.D. | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

Hello Rich,

   Super kewel! Two issues to report:

   1) When I add 'extrastyle=FS_LEFT' python complains about no global
variable called 'FS_LEFT'.

Mhm... it depends on how you actually import the module and you call it, I
think. In the demo, I do:

import FloatSpin as FS

Then:

self.floatspin1 = FS.FloatSpin(self.mainpanel, -1, min=0, max=1,
                                       increment=0.01, value=0.1,
extrastyle=FS.FS_LEFT)

Notice that the "extrastyle" parameter is called with FS.FS_LEFT. If you
want to call only "FS_LEFT", I think you should import the module as
follows:

from FloatSpin import *

But I wouldn't recommend it, it import a bunch of things in your scope.
However, it much depends on your Python style.

   2) I define 'initial=0.20' but the low value (0.00) is displayed

instead.

Yes, you are right. Actually, the "initial" parameter is quite useless (it's
never used in the code), so I have eliminated it. If you want to set the
initial value for FloatSpin, just pass it as parameter, like:

self.floatspin1 = FS.FloatSpin(self.mainpanel, -1, min=0, max=1,
                                       increment=0.01, value=0.1,
extrastyle=FS.FS_LEFT)

Here, value=0.1 is also the starting (initial) value. I have re-uploaded the
new version in the usual place:

http://xoomer.virgilio.it/infinity77/eng/freeware.html#floatspin

   It's certainly a great widget and I applaud your efforts and thank you.

Thanks a lot for your comments and thank you to have tried the demo :wink:

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77

Notice that the "extrastyle" parameter is called with FS.FS_LEFT. If you
want to call only "FS_LEFT", I think you should import the module as
follows:

from FloatSpin import *

Andrea,

   OK. That's my error. I forgot the namespace designator.

Yes, you are right. Actually, the "initial" parameter is quite useless
(it's never used in the code), so I have eliminated it. If you want to set
the initial value for FloatSpin, just pass it as parameter, like:

   Oh.

self.floatspin1 = FS.FloatSpin(self.mainpanel, -1, min=0, max=1,
                                      increment=0.01, value=0.1,
extrastyle=FS.FS_LEFT)

Here, value=0.1 is also the starting (initial) value. I have re-uploaded the
new version in the usual place:

   OK.

Thanks a lot for your comments and thank you to have tried the demo :wink:

   I've brought it into the application directory and am using it in my code.
I'll grab the latest version and change the calls to show the initial value.

Thanks,

Rich

···

On Wed, 7 Dec 2005, Andrea Gavana wrote:

--
Richard B. Shepard, Ph.D. | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863