masked edit controls (2.5.4.1) fails on Mac

Friends,

The problems seens to be at the masked controls
destructor.

I've did a small modification on my test code (see
below) to destroy masked.TextCtrl when you click on a
button. The same problem occurred again...

Marcio

# --- TEST_CODE: Click on the button to destroy
masked.TextCtrl ---
import wx
import wx.lib.masked as masked
import time

class MolduraPrincipal(wx.Frame):
  def __init__(self, *args, **kwds):
    kwds["style"] = wx.DEFAULT_FRAME_STYLE
    wx.Frame.__init__(self, *args, **kwds)
    tempo = time.localtime(time.time())
    data_fmt = time.strftime("%d/%m/%Y", tempo)
    autoformat = "EUDATEDDMMYYYY/"
    self.data = masked.TextCtrl(self, -1, data_fmt,
autoformat=autoformat, demo=True, name=autoformat)
    self.botao = wx.Button(self, -1, "Destroy")
    sz = wx.BoxSizer(wx.VERTICAL)
    sz.Add(self.botao, 0, 0, 0)
    sz.Add(self.data, 0, 0, 0)
    self.SetSizer(sz)
    self.Layout()
    self.Bind(wx.EVT_BUTTON, self.destruir, self.botao)
    
  def destruir(self, evento):
    self.data.Destroy()

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

···

--- Marcio Moreira <arqeco@yahoo.com.br> wrote:

Hello Friends,

Masked edit controls and Masked num ctrl fails on
Mac
OS X 10.3 version of wxPython 2.5.4.1 ANSI.

I've tested both, the wxPython Demo and the simple
code below. Both fails when you try to close the
app.
Instead of simply quit we've got a message that
says:
"Application has unexpectedly quit". When the app
has
been launched from Terminal we got a "Bus Error"
message.

I've upgraded from wxPython 2.5.2.8 to 2.5.4.1
because
I'd no sucess on trying to get wx.EVT_TEXT from
masked
controls on my App. It worked fine on 2.5.2.8 but
the
app fails on exit.

Thank you all in advance,
Marcio Moreira

Below is my test code:

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

class MolduraPrincipal(wx.Frame):
  def __init__(self, *args, **kwds):
    kwds["style"] = wx.DEFAULT_FRAME_STYLE
    wx.Frame.__init__(self, *args, **kwds)
    tempo = time.localtime(time.time())
    data_fmt = time.strftime("%d/%m/%Y", tempo)
    autoformat = "EUDATEDDMMYYYY/"
    self.data = masked.TextCtrl(self, -1, data_fmt,
autoformat=autoformat, demo=True, name=autoformat)
    sz = wx.BoxSizer(wx.VERTICAL)
    sz.Add(self.data, 0, 0, 0)
    self.SetSizer(sz)
    self.Layout()
    self.Bind(wx.EVT_TEXT, self.evento_texto,
self.data)
    
  def evento_texto(self, evento):
    print "CHANGED"

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

Yahoo! Acesso Grátis - Internet rápida e grátis.
Instale o discador agora!
http://br.acesso.yahoo.com/

---------------------------------------------------------------------

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

Yahoo! Acesso Grátis - Internet rápida e grátis.
Instale o discador agora! http://br.acesso.yahoo.com/

Note that if you hide the control (self.data.Show(False)) before calling the Destroy(), it works fine. I reported something similar yesterday on the wx-Mac list, where the error happened as long as a wx.TextCtrl had focus when it was destroyed. Hiding the control (or the whole Frame) prevented the problem. In my case, I noted that regular TextCtrl objects only did this when I had TypeIt4Me active.

      ___/
     /
    __/
   /
  ____/
  Ed Leafe
  http://leafe.com/
  http://dabodev.com/

···

On Apr 8, 2005, at 1:35 PM, Marcio Moreira wrote:

I've did a small modification on my test code (see
below) to destroy masked.TextCtrl when you click on a
button. The same problem occurred again...