RE: [wxPython] Sizer borders on windows
I was setting up a frame with the code that follows. A cyan border appears
around the top and left of the panel’s interior region, but not around
the bottom and right.
# create regions -- use a single panel as a child of the frame
# and then nest other panels and sizers within it.
p = wxPanel(self.__frame, -1);
p.SetBackgroundColour(wxBLUE);
# vertical stack of panels
gutter = 0;
outer = wxBoxSizer(wxVERTICAL);
top = wxPanel(p, -1);
#top.SetBackgroundColour(wxWHITE);
outer.Add(top, 1, wxEXPAND | wxALL, gutter);
nav = wxPanel(p, -1, style=wxRAISED_BORDER);
#nav.SetBackgroundColour(wxRED);
wxStaticText(nav, -1, "Navigation"); nav.Fit();
outer.Add(nav, 0, wxEXPAND | wxALL, gutter);
stat = wxPanel(p, -1);
#stat.SetBackgroundColour(wxGREEN);
wxStaticText(stat, -1, "Status/Information"); stat.Fit();
outer.Add(stat, 0, wxEXPAND | wxALL, gutter);
# horizontal stack of panels within top
inner = wxBoxSizer(wxHORIZONTAL);
right = wxPanel(top, -1);
right.SetBackgroundColour(wxCYAN);
# vertical stack of panels within right
gutter = 0;
ctrl = wxBoxSizer(wxVERTICAL);
logo = wxPanel(right, -1);
logo.SetBackgroundColour(wxLIGHT_GREY);
wxStaticText(logo, -1, "Logo region"); logo.Fit();
ctrl.Add(logo, 0, wxEXPAND | wxALL, gutter);
flow = wxPanel(right, -1);
flow.SetBackgroundColour(wxLIGHT_GREY);
wxStaticText(flow, -1, "Workflow region (very long string)"); flow.Fit();
ctrl.Add(flow, 0, wxEXPAND | wxALL, gutter);
task = wxPanel(right, -1);
task.SetBackgroundColour(wxLIGHT_GREY);
wxStaticText(task, -1, "Task region"); task.Fit();
ctrl.Add(task, 0, wxEXPAND | wxALL, gutter);
# now add the sizer for right to the horizontal
# stack within top
gutter = 5;
inner.Add(ctrl, 0, wxEXPAND | wxALL, gutter);
viewer = wxPanel(top, -1);
viewer.SetBackgroundColour(wxBLACK);
inner.Add(viewer, 1, wxEXPAND | wxALL, gutter);
# hook up sizers and lay it out
right.SetSizer(ctrl);
right.SetAutoLayout(TRUE);
ctrl.Fit(right);
top.SetSizer(inner);
top.SetAutoLayout(TRUE);
inner.Fit(top);
p.SetSizer(outer);
p.SetAutoLayout(TRUE);
outer.Fit(p);
···
-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: Friday, July 12, 2002 11:49 AM
To: wxpython-users@lists.wxwindows.org
Subject: Re: [wxPython] Sizer borders on windows
I’ve noticed that when adding an element to a sizer and giving it a
border,
the border doesn’t seem to be included on the far-right hand side. I’ve
tried both wxALL and wxRIGHT explicitly but neither seems to have an
effect, almost like when the sizer reports its size to the containing item
it
doesn’t include that border.
Anyone else see this? Is it just an understood behavior of sizers or am
I maybe nesting things incorrectly?
I’ve seen it once or twice at the bottom border, but havn’t looked into it
any further yet. If you can provide some simple test cases that show the
problem that would help.
–
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
wxpython-users mailing list