[wxPython-users] masked text controls?

Werner F. Bruhin werner.bruhin at free.fr
Mon Nov 6 12:36:49 PST 2006


Hi John,

John Salerno wrote:

> I was looking through the demo and noticed some pretty nice masked 
> text controls, for things like phone numbers, SS#, etc. But I'm not 
> sure how to use them. Is there a class I can use to get this 
> functionality, or were these things designed just for the demo to show 
> us what can be done? Would they have to be reimplemented to use them 
> in our own app?

Yeap, I just about only use the MaskedEdit controls, they are all there 
(check 'wx\lib\masked' folder), if you look at the demo you can see that 
there are predefined format codes etc etc etc for all this controls.

I use Boa which supports them, so I can just drop e.g. a masked numctrl 
onto a wx.Panel and change its properties and this code is generated:

Code snippet:
import wx.lib.masked.numctrl

        self.numCtrl1 = 
wx.lib.masked.numctrl.NumCtrl(id=wxID_PANEL1NUMCTRL1,
              name='numCtrl1', parent=self, pos=wx.Point(80, 24),
              size=wx.Size(99, 22), style=0, value=0)
        self.numCtrl1.SetAllowNegative(False)
        self.numCtrl1.SetAllowNone(True)

The module 'wx\lib\masked\maskededit.py' also contains extensive 
documentation.

Werner





More information about the wxpython-users mailing list