Hi,
I have a following layout:
···
------------------------------
Area 1: Buttons
------------------------------
Area 2: Notebook
------------------------------
Area 3: misc. controls
------------------------------
This is a vetical box sizer with 3 slots.
Dependig on pressing a button in area 1, the two other areas must change the content.
What's the best way to change the complete area 3? There must be a list control or a panel with button, text controls, ...
For area 2 (notebook) it's no problem: nb.DeleteAllPages, nb.AddPage is working well.
Andreas
I don't know about the best way but you could try adding them both to the sizer and setting their visibility via sizer.Show... like this:
self.sizer.Show(self.MiscControls1, True)
self.sizer.Show(self.MiscControls2, False)
self.sizer.Layout()
this will ensure that self.MiscControls1 will be visible and self.MiscControls2 not.
···
On Fri, 30 Apr 2004 18:35:49 +0200, Andreas Kaiser <akaiser@vocote.de> wrote:
Hi,
I have a following layout:
------------------------------
Area 1: Buttons
------------------------------
Area 2: Notebook
------------------------------
Area 3: misc. controls
------------------------------
This is a vetical box sizer with 3 slots.
Dependig on pressing a button in area 1, the two other areas must change the content.
What's the best way to change the complete area 3? There must be a list control or a panel with button, text controls, ...
For area 2 (notebook) it's no problem: nb.DeleteAllPages, nb.AddPage is working well.
Andreas
--
Peter Damoc
Hacker Wannabe
http://www.sigmacore.net/about.html
Two ways to do this.
The generic (and annoying) way is to create a panel that is
the sole content of "Area 3". Inside this panel, you create
however many sub-panels you need for your varying content.
They have a parent of the panel in "Area 3", but are NOT
part of a sizer (so they all sit on top of eachother).
Within these sub-panels you then use sizers to place the
controls. Then you simply use show/hide methods on the
sub-panels to get the appropriate one to appear.
All this is really just simulating a notebook. I don't
recall if wxPython allows it or not, but many GUI toolkits
allow you to create a notebook without tabs. The only way
to change which "tab" is visible is then from within the
program which simulates the situation you describe.
Another possibility that sometimes fits is to make your
"Area 1" butts actually notebook tabs. Then the first item
in the notebook is "Area 2" followed by "Area 3". If this
isn't quite realistic because you need to re-use the main
notebook, you can get the same effect by placing the "Area
2" notebook on the main panel manually instead of in the
"Area 1/3" notebook, then putting a spacer in the "Area 1/3"
notebook to get the controls in the right location.
What method is best really depends on exactly what your
trying to do. Good luck!
--David
···
On Fri, Apr 30, 2004 at 07:59:59PM +0300, Peter Damoc wrote:
On Fri, 30 Apr 2004 18:35:49 +0200, Andreas Kaiser <akaiser@vocote.de> > wrote:
>Hi,
>
>I have a following layout:
>
>------------------------------
>Area 1: Buttons
>------------------------------
>Area 2: Notebook
>------------------------------
>Area 3: misc. controls
>------------------------------
>
>This is a vetical box sizer with 3 slots.
>Dependig on pressing a button in area 1, the two other areas must change
>the content.
>
>What's the best way to change the complete area 3? There must be a list
>control or a panel with button, text controls, ...
>
>For area 2 (notebook) it's no problem: nb.DeleteAllPages, nb.AddPage is
>working well.
On Fri, 30 Apr 2004 18:35:49 +0200, Andreas Kaiser <akaiser@vocote.de>
I have a following layout:
------------------------------
Area 1: Buttons
------------------------------
Area 2: Notebook
------------------------------
Area 3: misc. controls
------------------------------
What's the best way to change the complete area 3? There must be a list control or a panel with button, text controls, ...
I've done this as follows:
create a set of wx.Panels for each version of Area 3. They might all be instances of the same class, or not, depending on how similar they are.
Add all the panels to the sizer, and call sizer.Hide() after each one is added. sizer.Show() the one you want shown first.
When you want to change the panel, sizer.Hide() the current one, and sizer.Show() the one you want.
I've enclosed a small app that demonstrates this. In it, all the panels are the same size. If they aren't in your case you may need an extra call to Sizer.Layout() or something.
Yes, as someone mentioned, this is just a way to simulate a notebook. If the other platforms had a vertical-tabbed-notebook like the GTK one, I wouldn't need this.
-Chris
Converter.py (10.9 KB)
···
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov