Tags: floatctrl, gtgti, gti, hong, lib, likegtgtwx, masked, numcrtl, numctrl, petersen, programming, python, qiangning, searching, wrotegthi, wrotejens

FloatCtrl?

On Programmer » Python

4,507 words with 1 Comments; publish: Sun, 04 May 2008 00:48:00 GMT; (20093.75, « »)

Qiangning Hong wrote:

Jens Petersen wrote:

>Hi,

>

>I think you'r searching something like

>

>wx.lib.masked.numctrl.NumCrtl()

>

I played around for a while with the NumCtrl demo, It seems that I

must specify the fraction width to allow input float numbers. Can it

be configured to allow input both "3.1" and "3.1415926" without the

annoying trailing zeros like "3.10000000"?

All the masked controls are designed to have fixed width, and the

numeric formats are currently designed to fill in the fractional

part with zeros. This is because there needs to be enough room in

the control to hold as many significant digits as allowed, with the

decimal point located at a fixed point in the control. I did not want

the the decimal point to be "floating in the middle" of the control,

so I chose to right-pad the fractional part with zeros; this also

simplified problems of justification and conversion. So I'm afraid

you can't get rid of the "annoying trailing zeros" with the NumCtrl.

(I wrote both the IntCtrl and the NumCtrl, both entirely in Python.

I wrote IntCtrl first, and then made NumCtrl, which is a more complicated,

but more sophisticated control, given it does grouping, multiple

numeric formats, right-insert, etc. However, you could always look

at IntCtrl and use it as a model for a simpler float control that

is more to your liking!)

Regrets,

/Will Sadkin

Author, lib.masked, IntCtrl

Parlance Corporation

www.parlancecorp.com

To unsubscribe, e-mail: wxPython-users-unsubscribe (AT) lists (DOT) wxwidgets.org

For additional commands, e-mail: wxPython-users-help (AT) lists (DOT) wxwidgets.org

All Comments

Leave a comment...

  • 1 Comments
    • Hi Will,

      As I mentioned on the list several weeks ago, NumCtrl uses '.' key to

      jump to decimal part even if the decimalChar is ','. It separates the

      decimal part with ',' though, which is correct.

      Is there a patch/workaround for this?

      Thanks in advance,

      Murat

      Will Sadkin wrote:

      >Qiangning Hong wrote:

      >

      >>Jens Petersen wrote:

      >

      >>

      Hi,

      I think you'r searching something like

      wx.lib.masked.numctrl.NumCrtl()

      >>I played around for a while with the NumCtrl demo, It seems that I

      >>must specify the fraction width to allow input float numbers. Can it

      >>be configured to allow input both "3.1" and "3.1415926" without the

      >>annoying trailing zeros like "3.10000000"?

      >

      >>

      >All the masked controls are designed to have fixed width, and the

      >numeric formats are currently designed to fill in the fractional

      >part with zeros. This is because there needs to be enough room in

      >the control to hold as many significant digits as allowed, with the

      >decimal point located at a fixed point in the control. I did not want

      >the the decimal point to be "floating in the middle" of the control,

      >so I chose to right-pad the fractional part with zeros; this also

      >simplified problems of justification and conversion. So I'm afraid

      >you can't get rid of the "annoying trailing zeros" with the NumCtrl.

      >

      >(I wrote both the IntCtrl and the NumCtrl, both entirely in Python.

      >I wrote IntCtrl first, and then made NumCtrl, which is a more complicated,

      >but more sophisticated control, given it does grouping, multiple

      >numeric formats, right-insert, etc. However, you could always look

      >at IntCtrl and use it as a model for a simpler float control that

      >is more to your liking!)

      >

      >Regrets,

      >/Will Sadkin

      >Author, lib.masked, IntCtrl

      >Parlance Corporation

      >www.parlancecorp.com

      >

      >

      >To unsubscribe, e-mail: wxPython-users-unsubscribe (AT) lists (DOT) wxwidgets.org

      >For additional commands, e-mail: wxPython-users-help (AT) lists (DOT) wxwidgets.org

      >

      >

      >

      To unsubscribe, e-mail: wxPython-users-unsubscribe (AT) lists (DOT) wxwidgets.org

      For additional commands, e-mail: wxPython-users-help (AT) lists (DOT) wxwidgets.org

      #1; Sun, 04 May 2008 00:49:00 GMT