show hide different panels

hi ,

i'm a wxpython newbie, i have to develop a step by step application.

for example the appz starts from step 1 (a form), then once the user
click on submit the appz must show step 2 (another form).

i was thinking to use one frame that contains many panels, one for each
step. so i can show and hide the panels to display the right form.

is that a good way to develop this tyoe of appz ? any suggestions ?

thanks :slight_smile:

Pietro Cottafavi <pietro.cottafavi <at> fastwebnet.it> writes:

i was thinking to use one frame that contains many panels, one for each
step. so i can show and hide the panels to display the right form.

is that a good way to develop this tyoe of appz ? any suggestions ?

Hi Pietro,

I did something similar at one point, and it ended up being fairly
straight-forward.

When it came time to switch to put different controls in my frame, I did a
DestroyChildren, and then added the new contents. Here is the code that removes
a login form, and displays a progress gague instead:

    def OnProgressStart(self, event):
        # replace our panel contents with a progress gague
        self.panel_1.DestroyChildren()
        
        self.gagueProgress = wx.Gauge(self.panel_1, -1, event.total)
        self.gagueProgress.SetBezelFace(3)
        self.gagueProgress.SetShadowWidth(3)
        self.gagueProgress.SetMinSize((180, -1))
        self.buttonCancel = wx.Button(self.panel_1, wx.ID_CANCEL, "Cancel")
        self.Bind(wx.EVT_BUTTON, self.OnCancel, self.buttonCancel)
        
        progressSizer = wx.BoxSizer(wx.VERTICAL)
        progressSizer.Add(self.gagueProgress, 0, wx.ADJUST_MINSIZE, 0)
        progressSizer.Add(self.buttonCancel, 0,
wx.TOP|wx.ALIGN_RIGHT|wx.ADJUST_MINSIZE, 10)
        self.panel_1.SetSizer(progressSizer)
        progressSizer.Fit(self.panel_1)
        progressSizer.SetSizeHints(self.panel_1)
        self.Layout()

        print "progress started"

路路路

#

Anyway... one easy alternative.
-Jim

Hi

i'm a wxpython newbie, i have to develop a step by step application.

for example the appz starts from step 1 (a form), then once the user
click on submit the appz must show step 2 (another form).

That sounds like a wizard, for that there is wx.wizard...
But i don't know any situation where such a step-by-step-working would
be useful.
For configuration things I would use a sizer, that contains a Notebook
and a second sizer for the buttons Ok, Cancel and Apply.
Another option would be a Choicebook or a Listbook.

i was thinking to use one frame that contains many panels, one for each
step. so i can show and hide the panels to display the right form.

In that way I've developed my second Python app. But it wasn't step by
step - there was a toolbar for switching between the different panels.
It worked quite well, but I think today I'd use a Listbook.

is that a good way to develop this tyoe of appz ? any suggestions ?

Well it depends... like always :slight_smile:
A sizer is a good idea, if you have some elements that are always
visible.

路路路

Am 06.09.2005 12:51:38 schrieb Pietro Cottafavi:
--
                                                     #1671 : icq-intern
Ohne Dich waeren die Gefuehle von heute #73628288 : icq-extern
nur die leere Huelle der Gefuehle von damals boesi111 : aim
      .-==Die fabelhafte Welt der Amelie==-. i171 : reallife

thanks guys for the suggestions :wink: