problem with frame inside frame

hi all.
My project is frame has button. When you click on it appear an child frame.
If the child frame is closed also the frame parent is closed. I wish
that this does not happen.
I wish that the frame parent remains open.
For test you run frame.py and click on button.

frame.py (687 Bytes)

formcreatetable.py (8.8 KB)

···

--
Fabio Spadaro
www.fabiospadaro.com

Hi,

hi all.
My project is frame has button. When you click on it appear an child frame.
If the child frame is closed also the frame parent is closed. I wish
that this does not happen.
I wish that the frame parent remains open.
For test you run frame.py and click on button.

Your missing some files so it wont run but there are some obvious problems.

Namely in frame.py you are trying to create more than one App object.
You only need to create one, creating more than one is an error. So
change your onCreateFrame method

FROM

    def onCreateFrame(self,evt):
        form = Form()
        #form = Frame2()
        app = wx.PySimpleApp()
        form.Show()
        app.SetTopWindow(form)
        app.MainLoop()

TO

    def onCreateFrame(self,evt):
        form = Form()
        form.Show()

Will fix some of the issues your having

Cody

···

On Wed, Sep 2, 2009 at 7:43 AM, Fabio Spadaro<fabiolinospad@gmail.com> wrote:

Does not work.
Attached the corrept script

frame.py (669 Bytes)

formcreatetable.py (8.8 KB)

···

2009/9/2 Cody Precord <codyprecord@gmail.com>:

Hi,

On Wed, Sep 2, 2009 at 7:43 AM, Fabio Spadaro<fabiolinospad@gmail.com> wrote:

hi all.
My project is frame has button. When you click on it appear an child frame.
If the child frame is closed also the frame parent is closed. I wish
that this does not happen.
I wish that the frame parent remains open.
For test you run frame.py and click on button.

Your missing some files so it wont run but there are some obvious problems.

Namely in frame.py you are trying to create more than one App object.
You only need to create one, creating more than one is an error. So
change your onCreateFrame method

FROM

def onCreateFrame(self,evt):
form = Form()
#form = Frame2()
app = wx.PySimpleApp()
form.Show()
app.SetTopWindow(form)
app.MainLoop()

TO

def onCreateFrame(self,evt):
form = Form()
form.Show()

Will fix some of the issues your having

Cody

>

--
Fabio Spadaro
www.fabiospadaro.com

Hi,

Does not work.
Attached the corrept script

In formcreatetable.py you are adding the same item to a sizer Twice,
this causes a double delete to happen when the window the sizer is
managing is deleted (when you close it). So this causes an exception
that is making your app crash.

sizerTot.Add(sizerGrid,1,wx.EXPAND)
sizerTot.Add(sizerButton,0,wx.EXPAND)
sizerTot.Add(sizerDummy)
sizerTot.Add(sizerButton2,0,wx.EXPAND)
sizerTot.Add(sizerDummy)

sizerDummy is being added 2 times.

Cody

···

On Wed, Sep 2, 2009 at 8:10 AM, Fabio Spadaro<fabiolinospad@gmail.com> wrote: