Masked.TextCtrl SetValue

Hi,

I create a masked.TextCtrl as follows:

ctrl = masked.TextCtrl(parent,id,mask="#{9}.#{4}",formatcodes="F-")

if I do the following:

ctrl.SetValue('1.0')

I get the following error:

ValueError: "1.0" cannot be inserted into the control "maskedTextCtrl"

I am trying to set the value programmatically. What am I doing wrong?

Regards,

Christoffer Sørensen

Christoffer,

Christoffer Sørensen wrote:

Hi,

I create a masked.TextCtrl as follows:

ctrl = masked.TextCtrl(parent,id,mask="#{9}.#{4}",formatcodes="F-")

if I do the following:

ctrl.SetValue('1.0')

I get the following error:

ValueError: "1.0" cannot be inserted into the control "maskedTextCtrl"

I am trying to set the value programmatically. What am I doing wrong?
  

I would suggest to use:
        self.numCtrl1 = wx.lib.masked.numctrl.NumCtrl(id=wxID_FRAME1NUMCTRL1,
              name='numCtrl1', parent=self.panel1, pos=wx.Point(55, 22),
              size=wx.Size(141, 22), style=0, value=0)
        self.numCtrl1.SetFractionWidth(4)

        self.numCtrl1.SetValue(1.0)

And/or have a look at OnNumberSelect method in the MaskedEditCtrl demo of wxPython.

Werner