changing to a second frame from the first frame

Hi folks,

I'm very new to wxpython. I wanted to create a gui app which takes
input from the user in the first page and pressing 'Next' takes them
to the next page. For the first page, i created a frame and added all
the needed stuff (referring the book wxpython-in-action) like the
fields, buttons, dropdowns etc..

As the next step, i want to configure the app to go to the second
frame while clicking on the 'Next' button. I dont want to use
wx.wizard, only if there is no other way. My idea was to create a
second frame and bind the 'Next' button to the second frame. But on
thinking twice, i thought its better to ask in the list... any ideas
on this, probably explaining a bit with a few lines of code would be
very much helpful and appreciated... It would be a simple query, but i
am not getting a clear idea on this.

Thank you,

Hi,

···

On Nov 24, 11:35 am, Py Bliss <pybl...@gmail.com> wrote:

Hi folks,

I'm very new to wxpython. I wanted to create a gui app which takes
input from the user in the first page and pressing 'Next' takes them
to the next page. For the first page, i created a frame and added all
the needed stuff (referring the book wxpython-in-action) like the
fields, buttons, dropdowns etc..

As the next step, i want to configure the app to go to the second
frame while clicking on the 'Next' button. I dont want to use
wx.wizard, only if there is no other way. My idea was to create a
second frame and bind the 'Next' button to the second frame. But on
thinking twice, i thought its better to ask in the list... any ideas
on this, probably explaining a bit with a few lines of code would be
very much helpful and appreciated... It would be a simple query, but i
am not getting a clear idea on this.

Thank you,

One fairly easy way would be to hide the panel that the form widgets
are on and show a new panel with new controls on it. This is basically
what the wizard does. Of course, when you hide a panel and show
another, you'll need to call the frame's Layout() method.

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

Mike and all others out there....

Thank you for the answer.

Apart from using the 'Layout()' method, is there any other way to do
this. I tried to do the following :

added the below snip to Frame1.py. I have imported Frame2 in
Frame1.py :

<snip>
    def Next(self, next):
        self.next = next
        frm2 = Frame2.Frame2(self)
        frm2.Show()
</snip>

'Next' is the event-handler or function which gets called when we
press 'Next' button. This brings up the frame 'Frame2'. The problem is
now i don't know how to make the Frame1 disappear when Frame2 comes
up. I want Frame1 to disappear and also get the user-entered details
in Frame1 to be saved and to be displayed in Frame2. The idea is, in
case the user does not feel the entered details as correct, they may
go back and correct it.

And as said before, i dont want to use wx.wizard

Sorry for being such a noob, what i've done till time is by reading
'wxpython-in-action'. i somehow am not able to connect the different
parts.... :frowning: ... may take time...

Thank you,.,

···

On Nov 24, 11:32 pm, Mike Driscoll <kyoso...@gmail.com> wrote:

Hi,

On Nov 24, 11:35 am, Py Bliss <pybl...@gmail.com> wrote:

> Hi folks,

> I'm very new to wxpython. I wanted to create a gui app which takes
> input from the user in the first page and pressing 'Next' takes them
> to the next page. For the first page, i created a frame and added all
> the needed stuff (referring the book wxpython-in-action) like the
> fields, buttons, dropdowns etc..

> As the next step, i want to configure the app to go to the second
> frame while clicking on the 'Next' button. I dont want to use
> wx.wizard, only if there is no other way. My idea was to create a
> second frame and bind the 'Next' button to the second frame. But on
> thinking twice, i thought its better to ask in the list... any ideas
> on this, probably explaining a bit with a few lines of code would be
> very much helpful and appreciated... It would be a simple query, but i
> am not getting a clear idea on this.

> Thank you,

One fairly easy way would be to hide the panel that the form widgets
are on and show a new panel with new controls on it. This is basically
what the wizard does. Of course, when you hide a panel and show
another, you'll need to call the frame's Layout() method.

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

Hi,

Mike and all others out there....

Thank you for the answer.

Apart from using the 'Layout()' method, is there any other way to do
this. I tried to do the following :

added the below snip to Frame1.py. I have imported Frame2 in
Frame1.py :

<snip>
def Next(self, next):
self.next = next
frm2 = Frame2.Frame2(self)
frm2.Show()
</snip>

'Next' is the event-handler or function which gets called when we
press 'Next' button. This brings up the frame 'Frame2'. The problem is
now i don't know how to make the Frame1 disappear when Frame2 comes
up. I want Frame1 to disappear and also get the user-entered details
in Frame1 to be saved and to be displayed in Frame2. The idea is, in
case the user does not feel the entered details as correct, they may
go back and correct it.

And as said before, i dont want to use wx.wizard

Sorry for being such a noob, what i've done till time is by reading
'wxpython-in-action'. i somehow am not able to connect the different
parts.... :frowning: ... may take time...

Thank you,.,

I'm having trouble understanding what it is you want to do. Normally
when you want to have a user go through a set of screens, you use
panels, not frames. Frames are top windows, panels are not. You might
find a wx.Notebook (or one of the other book controls) better for this
type of application. They provide methods for advancing to the next
page/tab, which is what you seem to need.

I wrote a tutorial on notebooks over the last couple of days, so you
can read that if you like (see link for my blog below). The wiki is
also a good place to learn and I also recommend googling for the
zetcode wxpython tutorial.

···

On Dec 3, 9:05 am, Py Bliss <pybl...@gmail.com> wrote:

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org