Joe Strout wrote:
Doh -- it's late. I meant that I needed to pass the main panel of the window -- the one the sizer sizes -- as the parent.
I was wondering about that...
This brings up a deeper issue: what exactly is a "panel"
It is a Window on which one can put other Controls/Windows.
and when do I need one?
when you want to group a bunch of controls that work together in some way.
Why can't I set a sizer for the frame itself?
you can. However, I think you need a panel to things like tabbing between controls.
When would I create more than one panel for a window?
when your controls have logical and/or visual groupings
If I do so, do they have any visible UI on any platform?
they can, depending on the style flags set, and things like background color.
I'm still reciting a lot of incantations without fully understanding what I'm doing. Any help gaining that deeper understanding would be greatly appreciated.
I hope that helped a bit.
The problem you had is very comon, and I think it stems from a lack of OO design. I try to make each Panel it's own class, then then add an instance of that class to the Frame or another panel, or....
In short, if you have names like:
self.A_Panel.A_control
or are doing things like:
Acontrol = wx.Something(self.Apanel, ...)
you'be got too mcuh nesting. Rather, you could do:
MyPanel(wx.Panel):
def __init__(.....)
...
ControlA = wx.something(self,...)
ControlB = wx.something(self,...)
S = wx.BoxSizer(...)
S.Add(ControlA,....)
S.Add(ControlB,....)
S.Add(ControlC,....)
self.SetSizer(S)
MyFrame(wx.Frame):
def __init__(.....):
ThePanel = MyPanel(self, ...)
This may help a bit:
wxPython Style Guide - wxPyWiki (see 7.)
-Chris
···
--
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