masked textctrl (works on Mac, but don't on Windows)

You have two options:
either follow my advice in my earlier response to your original
post, or install the latest release candidate,

Marcio Moreira wrote:

···

Dear Friends,

I'm trying to use the masked text control to deal with
dates in the DD/MM/YYYY format.

The code below works fine in Mac OS X but fails on
Windows 98. The error message says:

NameError: global name 'dbg' is not defined

Windows is running on the most recent version of
wxPython-ansi for Python 2.3.

Any suggestion?
Thanks in advance,
Marcio Moreira

# - - - - - - - - - - - - - - - -
import wx
import wx.lib.masked as masked
import time

class MolduraPrincipal(wx.Frame):
  def __init__(self, *args, **kwds):
    # begin wxGlade: MolduraPrincipal.__init__
    kwds["style"] = wx.DEFAULT_FRAME_STYLE
    wx.Frame.__init__(self, *args, **kwds)
    #
    tempo = time.localtime()
    data_fmt = time.strftime("%d/%m/%Y", tempo)
    ctrl_data = masked.Ctrl(self, -1, data_fmt,
      autoformat="EUDATEDDMMYYYY/")
    #,
    # demo=True, name=autoformat)
    #
    sz = wx.BoxSizer(wx.VERTICAL)
    sz.Add(ctrl_data, 0, 0, 0)
    #
    self.SetSizer(sz)
    self.Layout()

if __name__ == "__main__":
  app = wx.PySimpleApp(0)
  wx.InitAllImageHandlers()
  Moldura = MolduraPrincipal(None, -1, "")
  app.SetTopWindow(Moldura)
  Moldura.Show()
  app.MainLoop()

# - - - - - - - - - - - - - - - - - - -

C:\Faber>python masked-1.pyw
Traceback (most recent call last):
  File "masked-1.pyw", line 28, in ?
    Moldura = MolduraPrincipal(None, -1, "")
  File "masked-1.pyw", line 14, in __init__
    autoformat="EUDATEDDMMYYYY/")
  File
"C:\PYTHON23\Lib\site-packages\wx-2.5.3-msw-ansi\wx\lib\masked\ctrl.py",
line 90, in Ctrl
    return TextCtrl(*args, **kwargs)
  File
"C:\PYTHON23\Lib\site-packages\wx-2.5.3-msw-ansi\wx\lib\masked\textctrl.p
y", line 79, in __init__
    name=name, value=value,**kwargs )
  File
"C:\PYTHON23\Lib\site-packages\wx-2.5.3-msw-ansi\wx\lib\masked\textctrl.p
y", line 88, in _PostInit
    self._SetInitialValue(value)
  File
"C:\PYTHON23\Lib\site-packages\wx-2.5.3-msw-ansi\wx\lib\masked\maskededit
.py", line 2711, in _SetInitialValue
    self.SetValue(value) # use public
(validating) .SetValue()
  File
"C:\PYTHON23\Lib\site-packages\wx-2.5.3-msw-ansi\wx\lib\masked\textctrl.p
y", line 207, in SetValue
    elif self._isDate and not self.IsValid(value) and
self._4digityear:
  File
"C:\PYTHON23\Lib\site-packages\wx-2.5.3-msw-ansi\wx\lib\masked\maskededit
.py", line 4788, in IsValid
    ret = self._CheckValid(value)
  File
"C:\PYTHON23\Lib\site-packages\wx-2.5.3-msw-ansi\wx\lib\masked\maskededit
.py", line 5075, in _CheckValid
    valid = self._validateDate(value)
  File
"C:\PYTHON23\Lib\site-packages\wx-2.5.3-msw-ansi\wx\lib\masked\maskededit
.py", line 5256, in _validateDate
    if valid: dbg('valid date')
NameError: global name 'dbg' is not defined

Yahoo! Mail - Com 250MB de espaço. Abra sua conta!
http://mail.yahoo.com.br/

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org