Hi!
I get a segmentation fault when closing a second frame. I trimmed a
lot my program, and have the same behaviour in the code I put at the
end of the mail.
To reproduce it go to File, New, and close the frame that get opened.
I'm using wxPython 2.5.3, on Ubuntu Linux, with Python 2.4.1a0. The
same behaviour is reproducible in a Fedora Core 4 and in Windows
(don't know right now wxPython and Python versions in those systems).
Here's the code. Please help, as I don't know how to debug this error,
Thank you!!
···
-----------------------------------------------------------------------
import wx
class OtherFrame(wx.Frame):
def __init__(self, parent):
# initialize the frame
wx.Frame.__init__(self, parent, wx.NewId(), "Title")
panel1 = wx.Panel(self, wx.NewId())
date1 = wx.StaticText(panel1, -1, "Date 1")
box1 = wx.BoxSizer(wx.HORIZONTAL)
box1.Add(date1, 0)
panel1.SetSizer(box1)
panel2 = wx.Panel(self, wx.NewId())
date2 = wx.StaticText(panel2, -1, "Date 2")
box2 = wx.BoxSizer(wx.HORIZONTAL)
box2.Add(date2, 0)
panel2.SetSizer(box2)
# put everything in a box
box = wx.BoxSizer(wx.VERTICAL)
box.Add(box1, 0, wx.EXPAND | wx.ALL, border=0)
box.Add(box2, 0, wx.EXPAND | wx.ALL, border=0)
box.Fit(self)
self.SetSizer(box)
self.SetAutoLayout(True)
self.Show(True)
return
class MyFrame(wx.Frame):
def __init__(self, parent, ID, title):
wx.Frame.__init__(self, parent, ID, title, pos=(-1,-1),
size=wx.Size(200, 200))
menuBar = wx.MenuBar()
menu = wx.Menu()
menu.Append(1, "&New", "Test")
menuBar.Append(menu, "&File")
wx.EVT_MENU(self, 1, self.onTest)
self.SetMenuBar(menuBar)
self.Show(True)
return
def onTest(self, event):
OtherFrame(self)
return
class MyApp(wx.App):
def OnInit(self):
frame = MyFrame(None, -1, "Test")
frame.Show(True)
self.SetTopWindow(frame)
return True
if __name__ == "__main__":
app = MyApp(0)
app.MainLoop()
-----------------------------------------------------------------------
. Facundo
Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/