[wxPython] Show Attribute

Thanks Kevin and Mike

The method as you stated Kevin worked and the wxFrame2 showed up by using
this code in wxFrame1:

    def OnMnutestitems0Menu(self, event):
        CalcFrame = wxFrame2.create(self)
        CalcFrame.Show(true)
        
However I cannot get wxFrame2 to disappear. At the moment, all wxFrame2 has
in it is a button just to close it, ie:

    def OnButton1Button(self, event):
        self.Close()

I have tried self.Destroy() in place of the self.Close(), but that does not
seem to work either.

Any further suggestions?

Regards
Lynndon Harnell

···

-----Original Message-----
From: Kevin Gill [mailto:kevin@telcotec.com]
Sent: Tuesday, 12 June 2001 18:37
To: wxpython-users@lists.wxwindows.org
Subject: Re: [wxPython] Show Attribute

Lynndon Harnell wrote:

I have tried using Boa Constructor, to create an application which has
a main frame (window) which upon a toolbar or menu mouse click opens 1
or more secondary frames.

Boa creates a wxApp1, then wxFrame1, wxFrame2 etc, and the frames look
allright, and then in wxFrame1 I have inserted "import wxFrame2" (or
whatever) up front in the wxFrame1 code, but when I insert the code
wxFrame2.show() at the event, Boa returns an error code stating that
it cannot find the show attribute of wxFrame2.

You have to create the frame object before it can be displayed.
Boa places a function called create() into each frame module. This
create function will return an instance of the frame.

So ....

  myFrame = wxFrame2.create(parent)
  myFrame.Show(true)

  where parent is the parent frame, i.e. if you are calling this from
  within the wxFrame1 object, it will be self.

Good Luck

Kevin

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

"Harnell, Lynndon" wrote:

Thanks Kevin and Mike

The method as you stated Kevin worked and the wxFrame2 showed up by using
this code in wxFrame1:

    def OnMnutestitems0Menu(self, event):
        CalcFrame = wxFrame2.create(self)
        CalcFrame.Show(true)

However I cannot get wxFrame2 to disappear. At the moment, all wxFrame2 has
in it is a button just to close it, ie:

    def OnButton1Button(self, event):
        self.Close()

I have tried self.Destroy() in place of the self.Close(), but that does not
seem to work either.

This code seems correct ...

Try putting a print before and after the self.Close() to
ensure that it is executed. There may be some subtle problem with
indentation
which causes it to fail.

Also, print out the close method, to ensure that you have not redefined
it.

     def OnButton1Button(self, event):
   print "Before, ", self.Close
         self.Close()
   print "After"

If you still cannot find the problem, then paste your wxFrame2 source
into the
next mail, and I will run it.

···

Any further suggestions?

Regards
Lynndon Harnell

-----Original Message-----
From: Kevin Gill [mailto:kevin@telcotec.com]
Sent: Tuesday, 12 June 2001 18:37
To: wxpython-users@lists.wxwindows.org
Subject: Re: [wxPython] Show Attribute

Lynndon Harnell wrote:
>
> I have tried using Boa Constructor, to create an application which has
> a main frame (window) which upon a toolbar or menu mouse click opens 1
> or more secondary frames.
>
> Boa creates a wxApp1, then wxFrame1, wxFrame2 etc, and the frames look
> allright, and then in wxFrame1 I have inserted "import wxFrame2" (or
> whatever) up front in the wxFrame1 code, but when I insert the code
> wxFrame2.show() at the event, Boa returns an error code stating that
> it cannot find the show attribute of wxFrame2.

You have to create the frame object before it can be displayed.
Boa places a function called create() into each frame module. This
create function will return an instance of the frame.

So ....

        myFrame = wxFrame2.create(parent)
        myFrame.Show(true)

        where parent is the parent frame, i.e. if you are calling this from
        within the wxFrame1 object, it will be self.

Good Luck

Kevin

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users