pythonwxpython

Alternatives to wx.lib.masked.NumCtrl


In a wxPython application I'm developing I need a lot of input fields for numbers (integers and floats), so I tried using wx.lib.masked.NumCtrl, but my users now tell me that it's quite uncomfortable to use (and I agree with them).

Is there an alternative widget implementation I can use, or should I just roll my own, starting from a bare TextCtrl?

(wxPython 2.8.9.1)

Edit
For completeness, here's an example of "uncomfortableness":
given a NumCtrl with selectOnEntry and fractionWidth > 0, when you switch to the decimal part of the field, it gets correctly selected, but pressing numbers doesn't do anything, you have to delete the contents of the field first.


Solution

  • In the usual wxPython distribution there's IntCtrl, and then a few other GUI controls like Slider, Spin, FloatSpin, and KnobCtrl.

    There's also the Enthought Traits approach, and the GUI part of this seems to have put a fair amount of focus on numerical entry and display, such as logarithmic sliders, float array editors, etc. Looking at their designs might give some inspiration even if you don't take this path.

    Also, it's not really clear why you don't like the masked NumCtrl, but it's very easy to write your own, so if there's some specific thing you want, that's probably the way to go.